Skip to content

Commit

Permalink
conn: make StdNetBind.BatchSize() return 1 for non-Linux
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jwhited authored and zx2c4 committed Mar 10, 2023
1 parent 5819c6a commit f41f474
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conn/bind_std.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f41f474

Please sign in to comment.