http: disable keepalive when KeepAliveInterval is negative (#7158)

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
WeidiDeng 2025-08-21 05:31:15 +08:00 committed by GitHub
parent 5125fbed41
commit fdf610850b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -533,7 +533,7 @@ func (app *App) Start() error {
// create the listener for this socket
lnAny, err := listenAddr.Listen(app.ctx, portOffset, net.ListenConfig{
KeepAliveConfig: net.KeepAliveConfig{
Enable: srv.KeepAliveInterval != 0,
Enable: srv.KeepAliveInterval >= 0,
Interval: time.Duration(srv.KeepAliveInterval),
},
})