Use TryRLock in cleanup and add network dial in tests

This commit is contained in:
Theodor S. Midtlien
2026-07-08 16:12:37 +02:00
parent 705ed0566f
commit f817137c91
3 changed files with 135 additions and 20 deletions
+4 -1
View File
@@ -477,7 +477,10 @@ func (m *Manager) cleanUpUnusedRelays() {
defer m.relayClientsMutex.Unlock()
for addr, rt := range m.relayClients {
rt.Lock()
if !rt.TryRLock() {
// Skip while in-progress relay dial.
continue
}
// if the connection failed to the server the relay client will be nil
// but the instance will be kept in the relayClients until the next locking
if rt.err != nil {