mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Avoid sending unnecessairy udp key packets, and try config peers less often
This commit is contained in:
parent
c3e236b7fb
commit
82fd435211
2 changed files with 8 additions and 4 deletions
|
@ -262,9 +262,12 @@ func (c *Core) DEBUG_getGlobalUDPAddr() net.Addr {
|
|||
return c.udp.sock.LocalAddr()
|
||||
}
|
||||
|
||||
func (c *Core) DEBUG_sendUDPKeys(saddr string) {
|
||||
func (c *Core) DEBUG_maybeSendUDPKeys(saddr string) {
|
||||
addr := connAddr(saddr)
|
||||
c.udp.sendKeys(addr)
|
||||
c.udp.mutex.RLock()
|
||||
_, isIn := c.udp.conns[connAddr(addr)]
|
||||
c.udp.mutex.RUnlock()
|
||||
if !isIn { c.udp.sendKeys(addr) }
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue