core: Use KeepAliveConfig to pass keepalive_interval to listener's accepted sockets (#7151)

Fix #7144
This commit is contained in:
joshuamcbeth 2025-08-02 11:43:34 -04:00 committed by GitHub
parent 5bc2afbbb6
commit e4447c4ba7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 12 deletions

View file

@ -531,7 +531,12 @@ func (app *App) Start() error {
if h1ok || h2ok && useTLS || h2cok {
// create the listener for this socket
lnAny, err := listenAddr.Listen(app.ctx, portOffset, net.ListenConfig{KeepAlive: time.Duration(srv.KeepAliveInterval)})
lnAny, err := listenAddr.Listen(app.ctx, portOffset, net.ListenConfig{
KeepAliveConfig: net.KeepAliveConfig{
Enable: srv.KeepAliveInterval != 0,
Interval: time.Duration(srv.KeepAliveInterval),
},
})
if err != nil {
return fmt.Errorf("listening on %s: %v", listenAddr.At(portOffset), err)
}