Skip to content

Commit

Permalink
add active/idle only if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
lqs committed Apr 4, 2024
1 parent 5f77cae commit 8ec7984
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ func (s *server) updateConnState(conn net.Conn, state http.ConnState) {
switch state {
case http.StateNew:
s.connStateMap[conn] = state
case http.StateActive, http.StateIdle:
if _, ok := s.connStateMap[conn]; ok {
s.connStateMap[conn] = state
}
case http.StateHijacked, http.StateClosed:
delete(s.connStateMap, conn)
default:
// ignore other states
}
}

Expand Down

0 comments on commit 8ec7984

Please sign in to comment.