Ver código fonte

Don't deadlock after checking relay client status (fixes #2404)

Jakob Borg 10 anos atrás
pai
commit
f3dc78d457
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      lib/relay/relay.go

+ 2 - 1
lib/relay/relay.go

@@ -170,12 +170,13 @@ func (s *Svc) RelayStatus(uri string) (time.Duration, bool) {
 	}
 
 	s.mut.RLock()
+	defer s.mut.RUnlock()
+
 	for _, client := range s.clients {
 		if client.URI().String() == uri {
 			return client.Latency(), client.StatusOK()
 		}
 	}
-	s.mut.RUnlock()
 
 	return time.Hour, false
 }