Ignore errors when setting keepalive period is not supported by the system
This commit is contained in:
parent
a0c02f62a3
commit
db007efe00
1 changed files with 7 additions and 1 deletions
|
@ -2,11 +2,13 @@ package server
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
stdlog "log"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
proxyprotocol "github.com/c0va23/go-proxyprotocol"
|
||||
|
@ -340,8 +342,12 @@ func (ln tcpKeepAliveListener) Accept() (net.Conn, error) {
|
|||
}
|
||||
|
||||
if err = tc.SetKeepAlivePeriod(3 * time.Minute); err != nil {
|
||||
// Some systems, such as OpenBSD, have no user-settable per-socket TCP
|
||||
// keepalive options.
|
||||
if !errors.Is(err, syscall.ENOPROTOOPT) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return tc, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue