mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-29 15:31:35 +00:00
Notify switch idle
This commit is contained in:
parent
00bf71a09a
commit
4363283a6f
@ -45,6 +45,7 @@ func (l *awdl) create(boxPubKey *crypto.BoxPubKey, sigPubKey *crypto.SigPubKey,
|
|||||||
intf.peer.out = func(msg []byte) {
|
intf.peer.out = func(msg []byte) {
|
||||||
defer func() { recover() }()
|
defer func() { recover() }()
|
||||||
intf.send <- msg
|
intf.send <- msg
|
||||||
|
l.core.switchTable.idleIn <- intf.peer.port
|
||||||
}
|
}
|
||||||
go intf.handler()
|
go intf.handler()
|
||||||
l.core.switchTable.idleIn <- intf.peer.port
|
l.core.switchTable.idleIn <- intf.peer.port
|
||||||
@ -80,6 +81,7 @@ func (ai *awdlInterface) handler() {
|
|||||||
select {
|
select {
|
||||||
case p := <-ai.peer.linkOut:
|
case p := <-ai.peer.linkOut:
|
||||||
ai.send <- p
|
ai.send <- p
|
||||||
|
ai.awdl.core.switchTable.idleIn <- ai.peer.port
|
||||||
continue
|
continue
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
func (c *Core) AWDLRecvPacket(identity string) ([]byte, error) {
|
||||||
if intf := c.awdl.getInterface(identity); intf != nil {
|
if intf := c.awdl.getInterface(identity); intf != nil {
|
||||||
return <-intf.recv, nil
|
return <-intf.recv, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user