diff options
author | Jordan Whited <jordan@tailscale.com> | 2023-03-09 13:02:17 -0800 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-03-10 14:53:09 +0100 |
commit | f41f47446684028b1529653a505c0538b56ac91f (patch) | |
tree | 76fb64b9468a3083cb52ee777863ea3f8f02f58f /conn | |
parent | 5819c6af28239b973958a8d197f9e39926e7b9f1 (diff) |
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>
Diffstat (limited to 'conn')
-rw-r--r-- | conn/bind_std.go | 5 |
1 files changed, 4 insertions, 1 deletions
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 { |