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 <james@tailscale.com>
Signed-off-by: Jordan Whited <jordan@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jordan Whited 2023-03-09 13:02:17 -08:00 committed by Jason A. Donenfeld
parent 5819c6af28
commit f41f474466

View File

@ -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 // TODO: When all Binds handle IdealBatchSize, remove this dynamic function and
// rename the IdealBatchSize constant to BatchSize. // rename the IdealBatchSize constant to BatchSize.
func (s *StdNetBind) BatchSize() int { func (s *StdNetBind) BatchSize() int {
if runtime.GOOS == "linux" {
return IdealBatchSize return IdealBatchSize
}
return 1
} }
func (s *StdNetBind) Close() error { func (s *StdNetBind) Close() error {