mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-06-15 16:46:06 +00:00
use the subnet derived ID/mask when creating a connection based on a subnet address, fix a potential blocking channel send in tuntap/conn.go, and get debug.go compiling well enough to profile things (the sim is currently still broken)
This commit is contained in:
@ -41,7 +41,12 @@ func (s *tunConn) reader() error {
|
||||
select {
|
||||
case <-read:
|
||||
if n > 0 {
|
||||
s.tun.send <- append(util.GetBytes(), b[:n]...)
|
||||
bs := append(util.GetBytes(), b[:n]...)
|
||||
select {
|
||||
case s.tun.send <- bs:
|
||||
default:
|
||||
util.PutBytes(bs)
|
||||
}
|
||||
}
|
||||
case <-s.stop:
|
||||
s.tun.log.Debugln("Stopping conn reader for", s)
|
||||
|
@ -190,7 +190,11 @@ func (tun *TunAdapter) reader() error {
|
||||
if !isIn || session == nil {
|
||||
// Neither an address nor a subnet mapping matched, therefore populate
|
||||
// the node ID and mask to commence a search
|
||||
dstNodeID, dstNodeIDMask = dstAddr.GetNodeIDandMask()
|
||||
if dstAddr.IsValid() {
|
||||
dstNodeID, dstNodeIDMask = dstAddr.GetNodeIDandMask()
|
||||
} else {
|
||||
dstNodeID, dstNodeIDMask = dstSnet.GetNodeIDandMask()
|
||||
}
|
||||
}
|
||||
}
|
||||
tun.mutex.RUnlock()
|
||||
|
Reference in New Issue
Block a user