mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-10 15:30:34 +03:00
fix dial bug
This commit is contained in:
parent
ab59129557
commit
c97dd4ad28
@ -247,13 +247,15 @@ func (tun *TunAdapter) _handlePacket(recvd []byte, err error) {
|
||||
}
|
||||
if !known {
|
||||
go func() {
|
||||
if conn, err := tun.dialer.DialByNodeIDandMask(dstNodeID, dstNodeIDMask); err == nil {
|
||||
conn, err := tun.dialer.DialByNodeIDandMask(dstNodeID, dstNodeIDMask)
|
||||
tun.RecvFrom(nil, func() {
|
||||
// We've been given a connection so prepare the session wrapper
|
||||
packets := tun.dials[*dstNodeID]
|
||||
delete(tun.dials, *dstNodeID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// We've been given a connection so prepare the session wrapper
|
||||
var tc *tunConn
|
||||
var err error
|
||||
if tc, err = tun._wrap(conn); err != nil {
|
||||
// Something went wrong when storing the connection, typically that
|
||||
// something already exists for this address or subnet
|
||||
@ -264,7 +266,7 @@ func (tun *TunAdapter) _handlePacket(recvd []byte, err error) {
|
||||
tc.writeFrom(nil, packet)
|
||||
}
|
||||
})
|
||||
}
|
||||
return
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ const (
|
||||
// notify the intf that we're currently sending
|
||||
func (intf *linkInterface) notifySending(size int, isLinkTraffic bool) {
|
||||
intf.RecvFrom(nil, func() {
|
||||
if !isLinkTraffic && size > 0 {
|
||||
if !isLinkTraffic {
|
||||
intf.inSwitch = false
|
||||
}
|
||||
intf.sendTimer = time.AfterFunc(sendBlockedTime, intf.notifyBlockedSend)
|
||||
|
Loading…
Reference in New Issue
Block a user