conn: inch BatchSize toward being non-dynamic

There's not really a use at the moment for making this configurable, and
once bind_windows.go behaves like bind_std.go, we'll be able to use
constants everywhere. So begin that simplification now.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2023-03-04 15:25:46 +01:00
parent f26efb65f2
commit dbd949307e
8 changed files with 19 additions and 23 deletions

View File

@@ -524,7 +524,7 @@ func (tun *NativeTun) initFromFlags(name string) error {
return
}
tun.vnetHdr = true
tun.batchSize = conn.DefaultBatchSize
tun.batchSize = conn.IdealBatchSize
} else {
tun.batchSize = 1
}
@@ -577,7 +577,7 @@ func CreateTUNFromFile(file *os.File, mtu int) (Device, error) {
statusListenersShutdown: make(chan struct{}),
tcp4GROTable: newTCPGROTable(),
tcp6GROTable: newTCPGROTable(),
toWrite: make([]int, 0, conn.DefaultBatchSize),
toWrite: make([]int, 0, conn.IdealBatchSize),
}
name, err := tun.Name()
@@ -633,7 +633,7 @@ func CreateUnmonitoredTUNFromFD(fd int) (Device, string, error) {
errors: make(chan error, 5),
tcp4GROTable: newTCPGROTable(),
tcp6GROTable: newTCPGROTable(),
toWrite: make([]int, 0, conn.DefaultBatchSize),
toWrite: make([]int, 0, conn.IdealBatchSize),
}
name, err := tun.Name()
if err != nil {