Skip to content

Commit d3cb5bd

Browse files
committed
conn: move booleans to bottom of StdNetBind struct
This results in a more compact structure. Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 6a07b2a commit d3cb5bd

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

conn/bind_std.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,18 @@ var (
2929
// methods for sending and receiving multiple datagrams per-syscall. See the
3030
// proposal in https://github.com/golang/go/issues/45886#issuecomment-1218301564.
3131
type StdNetBind struct {
32-
mu sync.Mutex // protects following fields
33-
ipv4 *net.UDPConn
34-
ipv6 *net.UDPConn
35-
blackhole4 bool
36-
blackhole6 bool
37-
ipv4PC *ipv4.PacketConn // will be nil on non-Linux
38-
ipv6PC *ipv6.PacketConn // will be nil on non-Linux
32+
mu sync.Mutex // protects following fields
33+
ipv4 *net.UDPConn
34+
ipv6 *net.UDPConn
35+
ipv4PC *ipv4.PacketConn // will be nil on non-Linux
36+
ipv6PC *ipv6.PacketConn // will be nil on non-Linux
3937

4038
udpAddrPool sync.Pool // following fields are not guarded by mu
4139
ipv4MsgsPool sync.Pool
4240
ipv6MsgsPool sync.Pool
41+
42+
blackhole4 bool
43+
blackhole6 bool
4344
}
4445

4546
func NewStdNetBind() Bind {

0 commit comments

Comments
 (0)