From d3cb5bda6e3d4a27bc713e136fe7a30df741bb7d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 24 Mar 2023 16:21:46 +0100 Subject: [PATCH] conn: move booleans to bottom of StdNetBind struct This results in a more compact structure. Signed-off-by: Jason A. Donenfeld --- conn/bind_std.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/conn/bind_std.go b/conn/bind_std.go index ab2bd85ef..b4c65dfa8 100644 --- a/conn/bind_std.go +++ b/conn/bind_std.go @@ -29,17 +29,18 @@ var ( // methods for sending and receiving multiple datagrams per-syscall. See the // proposal in https://github.com/golang/go/issues/45886#issuecomment-1218301564. type StdNetBind struct { - mu sync.Mutex // protects following fields - ipv4 *net.UDPConn - ipv6 *net.UDPConn - blackhole4 bool - blackhole6 bool - ipv4PC *ipv4.PacketConn // will be nil on non-Linux - ipv6PC *ipv6.PacketConn // will be nil on non-Linux + mu sync.Mutex // protects following fields + ipv4 *net.UDPConn + ipv6 *net.UDPConn + ipv4PC *ipv4.PacketConn // will be nil on non-Linux + ipv6PC *ipv6.PacketConn // will be nil on non-Linux udpAddrPool sync.Pool // following fields are not guarded by mu ipv4MsgsPool sync.Pool ipv6MsgsPool sync.Pool + + blackhole4 bool + blackhole6 bool } func NewStdNetBind() Bind {