From f41f47446684028b1529653a505c0538b56ac91f Mon Sep 17 00:00:00 2001 From: Jordan Whited Date: Thu, 9 Mar 2023 13:02:17 -0800 Subject: 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 Signed-off-by: Jordan Whited Signed-off-by: Jason A. Donenfeld --- conn/bind_std.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/conn/bind_std.go b/conn/bind_std.go index 0266d6b..1ee2cef 100644 --- a/conn/bind_std.go +++ b/conn/bind_std.go @@ -272,7 +272,10 @@ func (s *StdNetBind) makeReceiveIPv6(pc *ipv6.PacketConn, conn *net.UDPConn) Rec // TODO: When all Binds handle IdealBatchSize, remove this dynamic function and // rename the IdealBatchSize constant to BatchSize. func (s *StdNetBind) BatchSize() int { - return IdealBatchSize + if runtime.GOOS == "linux" { + return IdealBatchSize + } + return 1 } func (s *StdNetBind) Close() error { -- cgit v1.2.3-54-g00ecf