Close web socket connections in all paths. (#4747)
* Close web socket connections in all paths. There was a leak of WebSocket pingWorker if the initial response write errored as it did not close the WebSocket connection. * graceful close
This commit is contained in:
@@ -211,8 +211,10 @@ func (s *AgentService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if s.signalMessageSizeLimit > 0 {
|
||||
conn.SetReadLimit(s.signalMessageSizeLimit)
|
||||
}
|
||||
s.HandleConnection(r.Context(), NewWSSignalConnection(conn, s.signalMessageSizeLimit), registration)
|
||||
conn.Close()
|
||||
sigConn := NewWSSignalConnection(conn, s.signalMessageSizeLimit)
|
||||
defer sigConn.Close()
|
||||
|
||||
s.HandleConnection(r.Context(), sigConn, registration)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user