get rid of mutexes and use a single loop to prevent races.
in the meantime change the API to makes a little less error-prone.
This commit is contained in:
2
pool.go
2
pool.go
@@ -35,7 +35,7 @@ func (pool *SimplePool) EnsureRelay(url string) (*Relay, error) {
|
||||
defer pool.mutex.Unlock()
|
||||
|
||||
relay, ok := pool.Relays[nm]
|
||||
if ok && relay.connectionContext.Err() == nil {
|
||||
if ok && relay.IsConnected() {
|
||||
// already connected, unlock and return
|
||||
return relay, nil
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user