mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-02 10:01:57 +00:00
wgengine/magicsock: remove allocs in UDP write, use new netaddr.PutUDPAddr
The allocs were only introduced yesterday with a TODO. Now they're gone again.
This commit is contained in:
@@ -805,8 +805,9 @@ var errDropDerpPacket = errors.New("too many DERP packets queued; dropping")
|
||||
|
||||
// sendUDP sends UDP packet b to ipp.
|
||||
func (c *Conn) sendUDP(ipp netaddr.IPPort, b []byte) error {
|
||||
addr := ipp.UDPAddr() // TOOD(bradfitz): add alloc-free netaddr.WriteTo helper
|
||||
return c.sendUDPStd(addr, b)
|
||||
ua := ipp.UDPAddr()
|
||||
defer netaddr.PutUDPAddr(ua)
|
||||
return c.sendUDPStd(ua, b)
|
||||
}
|
||||
|
||||
func (c *Conn) sendUDPStd(addr *net.UDPAddr, b []byte) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user