2023-01-05 14:41:03 +00:00
|
|
|
// Copyright (C) 2023 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
2023-01-31 13:59:04 +00:00
|
|
|
const tcpFastOpenServer = 15
|
2023-01-05 14:41:03 +00:00
|
|
|
|
|
|
|
func setTCPFastOpen(fd uintptr, queue int) error {
|
2023-01-31 13:59:04 +00:00
|
|
|
return syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, tcpFastOpenServer, 1)
|
2023-01-05 14:41:03 +00:00
|
|
|
}
|
|
|
|
|
2023-06-02 15:17:23 +01:00
|
|
|
// tryInitFastOpen returns true if fastopen support is possibly enabled.
|
|
|
|
func tryInitFastOpen(*zap.Logger) bool {
|
2023-01-31 14:00:44 +00:00
|
|
|
// should we log or check something along the lines of
|
|
|
|
// netsh int tcp set global fastopen=enabled
|
|
|
|
// netsh int tcp set global fastopenfallback=disabled
|
|
|
|
// ?
|
2023-06-02 15:17:23 +01:00
|
|
|
return false
|
2023-01-31 14:00:44 +00:00
|
|
|
}
|