Skip to content

Commit 99a7877

Browse files
committed
Add lock to websocket Connections method
Signed-off-by: Lorenzo <[email protected]>
1 parent b823b15 commit 99a7877

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ws/websocket.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ func (server *Server) Addr() *net.TCPAddr {
376376
}
377377

378378
func (server *Server) Connections(websocketId string) *WebSocket {
379+
server.connMutex.RLock()
380+
defer server.connMutex.RUnlock()
379381
return server.connections[websocketId]
380382
}
381383

0 commit comments

Comments
 (0)