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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
stdlog "log"
|
stdlog "log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
proxyprotocol "github.com/c0va23/go-proxyprotocol"
|
proxyprotocol "github.com/c0va23/go-proxyprotocol"
|
||||||
|
@ -340,7 +342,11 @@ func (ln tcpKeepAliveListener) Accept() (net.Conn, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = tc.SetKeepAlivePeriod(3 * time.Minute); err != nil {
|
if err = tc.SetKeepAlivePeriod(3 * time.Minute); err != nil {
|
||||||
return nil, err
|
// 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
|
return tc, nil
|
||||||
|
|
Loading…
Reference in a new issue