Skip to content

Commit 226cddc

Browse files
author
Evgeniy Ivakha
committed
data race fix
1 parent 1db58ba commit 226cddc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

wamp.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,13 @@ func (w *Wango) Subscribe(uri string, fn func(uri string, event interface{}), id
276276
if uri == "" {
277277
return errors.New("Empty uri")
278278
}
279+
280+
w.connectionsLocker.RLock()
279281
if len(w.connections) == 0 {
282+
w.connectionsLocker.RUnlock()
280283
return errors.New("No active connections")
281284
}
282-
w.connectionsLocker.RLock()
285+
283286
var c *Conn
284287
if id != nil {
285288
_c, ok := w.connections[id[0]]

0 commit comments

Comments
 (0)