Skip to content

Commit

Permalink
reduced scope of lock to prevent possible deadlocks (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
igm authored Nov 11, 2021
1 parent 2de2e38 commit e2b1424
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions v3/sockjs/jsonp.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ func (h *Handler) jsonpSend(rw http.ResponseWriter, req *http.Request) {
}
sessionID, _ := h.parseSessionID(req.URL)
h.sessionsMux.Lock()
defer h.sessionsMux.Unlock()
if sess, ok := h.sessions[sessionID]; !ok {
sess, ok := h.sessions[sessionID]
h.sessionsMux.Unlock()
if !ok {
http.NotFound(rw, req)
} else {
if err := sess.accept(messages...); err != nil {
Expand Down

0 comments on commit e2b1424

Please sign in to comment.