diff options
author | Alex Schultz <aschultz@redhat.com> | 2020-10-31 18:26:32 -0600 |
---|---|---|
committer | Alex Schultz <aschultz@redhat.com> | 2020-10-31 20:31:33 -0600 |
commit | 0ac857fc0fc0be3b53ecdf1de30047d48adc4a8c (patch) | |
tree | 46c20ff9ca3ba9ec0da8a29b4049c1051a8b5b04 /pkg/api/server/idle | |
parent | 2aaa036f560e2c42ebb033869eeef539dbc47fef (diff) | |
download | podman-0ac857fc0fc0be3b53ecdf1de30047d48adc4a8c.tar.gz podman-0ac857fc0fc0be3b53ecdf1de30047d48adc4a8c.tar.bz2 podman-0ac857fc0fc0be3b53ecdf1de30047d48adc4a8c.zip |
Change http ConnState actions between new and active
Currently it double counts connections because it's incrementing the
total for both the new and active states. Based on the comments, we
should only count new connections for the total count and perform the
timer stop actions when the connection has transitioned to an active
state.
Closes #8208
Signed-off-by: Alex Schultz <aschultz@redhat.com>
Diffstat (limited to 'pkg/api/server/idle')
-rw-r--r-- | pkg/api/server/idle/tracker.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/api/server/idle/tracker.go b/pkg/api/server/idle/tracker.go index 50e41b7bf..687ebd7d4 100644 --- a/pkg/api/server/idle/tracker.go +++ b/pkg/api/server/idle/tracker.go @@ -41,11 +41,12 @@ func (t *Tracker) ConnState(conn net.Conn, state http.ConnState) { logrus.Debugf("IdleTracker %p:%v %dm+%dh/%dt connection(s)", conn, state, len(t.managed), t.hijacked, t.TotalConnections()) switch state { - case http.StateNew, http.StateActive: + case http.StateNew: + t.total++ + case http.StateActive: // stop the API timer when the server transitions any connection to an "active" state t.managed[conn] = struct{}{} t.timer.Stop() - t.total++ case http.StateHijacked: // hijacked connections should call Close() when finished. // Note: If a handler hijack's a connection and then doesn't Close() it, |