From 961a23b9df7b10e43bd753b795d2d5495dcf3a07 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 6 Jul 2021 12:26:14 -0700 Subject: [PATCH] tewak --- wgengine/magicsock/magicsock.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 1dab30a8d..573db07df 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -2861,17 +2861,17 @@ func (c *RebindingUDPConn) ReadFromNetaddr(b []byte) (n int, ipp netaddr.IPPort, for { pconn := c.currentConn() - // Optimization: Treat a few conn types specially. - // *uring.UDPConn can return netaddr.IPPorts directly. + // Optimization: Treat a few pconn types specially. // For *net.UDPConn, ReadFromUDP gets partially inlined, avoiding allocating a *net.UDPAddr, // as long as pAddr itself doesn't escape. + // *uring.UDPConn can return netaddr.IPPorts directly. // The default case works, but it allocates. var pAddr *net.UDPAddr switch pconn := pconn.(type) { - case *uring.UDPConn: - n, ipp, err = pconn.ReadFromNetaddr(b) case *net.UDPConn: n, pAddr, err = pconn.ReadFromUDP(b) + case *uring.UDPConn: + n, ipp, err = pconn.ReadFromNetaddr(b) default: var addr net.Addr n, addr, err = pconn.ReadFrom(b)