From 4363283a6f6ec33a462aa37709ca6a35c90e1603 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 5 Jan 2019 00:32:28 +0000 Subject: [PATCH] Notify switch idle --- src/yggdrasil/awdl.go | 2 ++ src/yggdrasil/mobile.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/yggdrasil/awdl.go b/src/yggdrasil/awdl.go index 84cd3fb..3bd6360 100644 --- a/src/yggdrasil/awdl.go +++ b/src/yggdrasil/awdl.go @@ -45,6 +45,7 @@ func (l *awdl) create(boxPubKey *crypto.BoxPubKey, sigPubKey *crypto.SigPubKey, intf.peer.out = func(msg []byte) { defer func() { recover() }() intf.send <- msg + l.core.switchTable.idleIn <- intf.peer.port } go intf.handler() l.core.switchTable.idleIn <- intf.peer.port @@ -80,6 +81,7 @@ func (ai *awdlInterface) handler() { select { case p := <-ai.peer.linkOut: ai.send <- p + ai.awdl.core.switchTable.idleIn <- ai.peer.port continue default: } diff --git a/src/yggdrasil/mobile.go b/src/yggdrasil/mobile.go index af7abb7..a81d82c 100644 --- a/src/yggdrasil/mobile.go +++ b/src/yggdrasil/mobile.go @@ -115,6 +115,10 @@ func (c *Core) AWDLCreateInterface(boxPubKey string, sigPubKey string, name stri } } +func (c *Core) AWDLShutdownInterface(name string) { + c.awdl.shutdown(name) +} + func (c *Core) AWDLRecvPacket(identity string) ([]byte, error) { if intf := c.awdl.getInterface(identity); intf != nil { return <-intf.recv, nil