mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Switch connAddr (udp map key) from string to a struct that allocates less. Reduce some other allocations. Use larger channel buffers to reduce backpressure from runtime jitter.
This commit is contained in:
parent
ef1e0c902f
commit
75965b6da4
6 changed files with 60 additions and 28 deletions
|
@ -274,9 +274,14 @@ func (c *Core) DEBUG_getGlobalUDPAddr() net.Addr {
|
|||
}
|
||||
|
||||
func (c *Core) DEBUG_maybeSendUDPKeys(saddr string) {
|
||||
addr := connAddr(saddr)
|
||||
udpAddr, err := net.ResolveUDPAddr("udp", saddr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var addr connAddr
|
||||
addr.fromUDPAddr(udpAddr)
|
||||
c.udp.mutex.RLock()
|
||||
_, isIn := c.udp.conns[connAddr(addr)]
|
||||
_, isIn := c.udp.conns[addr]
|
||||
c.udp.mutex.RUnlock()
|
||||
if !isIn {
|
||||
c.udp.sendKeys(addr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue