private/server: tcp_fastopen failures should not kill the server
Change-Id: Iec42524f83619c22d8be26f373978e8abd468ee8
This commit is contained in:
parent
053beef8c4
commit
c17ceef093
@ -15,4 +15,9 @@ func setTCPFastOpen(fd uintptr, queue int) error {
|
||||
return syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, tcpFastOpenServer, 1)
|
||||
}
|
||||
|
||||
func tryInitFastOpen(*zap.Logger) {}
|
||||
func tryInitFastOpen(*zap.Logger) {
|
||||
// should we log or check something along the lines of
|
||||
// netsh int tcp set global fastopen=enabled
|
||||
// netsh int tcp set global fastopenfallback=disabled
|
||||
// ?
|
||||
}
|
||||
|
@ -130,11 +130,12 @@ func New(log *zap.Logger, tlsOptions *tlsopts.Options, config Config) (_ *Server
|
||||
if config.TCPFastOpen {
|
||||
tryInitFastOpen(log)
|
||||
listenConfig.Control = func(network, address string, c syscall.RawConn) error {
|
||||
var internalErr error
|
||||
err := c.Control(func(fd uintptr) {
|
||||
internalErr = setTCPFastOpen(fd, config.TCPFastOpenQueue)
|
||||
return c.Control(func(fd uintptr) {
|
||||
err := setTCPFastOpen(fd, config.TCPFastOpenQueue)
|
||||
if err != nil {
|
||||
log.Sugar().Infof("failed to set tcp fast open for this socket: %v", err)
|
||||
}
|
||||
})
|
||||
return errs.Combine(err, internalErr)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user