Skip to content

Commit

Permalink
fix(ws): only send the websocket error when the channel is not closed…
Browse files Browse the repository at this point in the history
… already.
  • Loading branch information
Marco Trettner committed Jan 24, 2023
1 parent 7cf6811 commit 1f0c95e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ws/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ func (server *Server) SetCheckOriginHandler(handler func(r *http.Request) bool)
func (server *Server) error(err error) {
log.Error(err)
if server.errC != nil {
server.errC <- err
select {
case <-server.errC:
log.Debug("servers errC is closed, so we can't send the error!")
default:
server.errC <- err
}
}
}

Expand Down

0 comments on commit 1f0c95e

Please sign in to comment.