We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
sync.RWMutex
connections
1 parent 5853568 commit 506d193Copy full SHA for 506d193
backend/server/ws.go
@@ -41,7 +41,7 @@ func (connection *connection) handleFrame(ctx context.Context) error {
41
42
type connections struct {
43
data map[*connection]bool
44
- mutex sync.Mutex
+ mutex sync.RWMutex
45
}
46
47
func newConnections() connections {
@@ -61,8 +61,8 @@ func (connections *connections) delete(key *connection) {
61
62
63
func (connections *connections) close() {
64
- connections.mutex.Lock()
65
- defer connections.mutex.Unlock()
+ connections.mutex.RLock()
+ defer connections.mutex.RUnlock()
66
67
for connection := range connections.data {
68
connection.Close(websocket.StatusNormalClosure, "server shutting down")
0 commit comments