Skip to content

Commit f41f474

Browse files
jwhitedzx2c4
authored andcommitted
conn: make StdNetBind.BatchSize() return 1 for non-Linux
This commit updates StdNetBind.BatchSize() to return 1 instead of IdealBatchSize for non-Linux platforms. Non-Linux platforms do not yet benefit from values > 1, which only serves to increase memory consumption. Reviewed-by: James Tucker <[email protected]> Signed-off-by: Jordan Whited <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 5819c6a commit f41f474

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

conn/bind_std.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ func (s *StdNetBind) makeReceiveIPv6(pc *ipv6.PacketConn, conn *net.UDPConn) Rec
272272
// TODO: When all Binds handle IdealBatchSize, remove this dynamic function and
273273
// rename the IdealBatchSize constant to BatchSize.
274274
func (s *StdNetBind) BatchSize() int {
275-
return IdealBatchSize
275+
if runtime.GOOS == "linux" {
276+
return IdealBatchSize
277+
}
278+
return 1
276279
}
277280

278281
func (s *StdNetBind) Close() error {

0 commit comments

Comments
 (0)