diff options
author | Kassio Borges <kborges@gitlab.com> | 2022-04-01 10:55:29 +0300 |
---|---|---|
committer | Vladimir Shushlin <vshushlin@gitlab.com> | 2022-04-01 10:55:29 +0300 |
commit | 43e42a8b797732a013f4c01cc0193643bff614e0 (patch) | |
tree | 55efb31ce95f02d6d95d2e742b44605dbfc6bb08 /server.go | |
parent | f6ada25223c6f9b531a1e30da576ee042b361c2e (diff) |
Fix weak timeouts
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -7,7 +7,6 @@ import ( stdlog "log" "net" "net/http" - "time" "github.com/pires/go-proxyproto" "github.com/sirupsen/logrus" @@ -40,8 +39,12 @@ func (a *theApp) listenAndServe(server *http.Server, addr string, h http.Handler server.TLSConfig.NextProtos = append(server.TLSConfig.NextProtos, "h2") } + server.ReadTimeout = a.config.Server.ReadTimeout + server.ReadHeaderTimeout = a.config.Server.ReadHeaderTimeout + server.WriteTimeout = a.config.Server.WriteTimeout + lc := net.ListenConfig{ - KeepAlive: 3 * time.Minute, + KeepAlive: a.config.Server.ListenKeepAlive, } l, err := lc.Listen(context.Background(), "tcp", addr) |