mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-19 15:01:29 +02:00
use relay manager.getClientLen()
This commit is contained in:
@@ -350,6 +350,12 @@ func (m *Manager) startCleanupLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Manager) getClientLen() int {
|
||||
m.relayClientsMutex.Lock()
|
||||
defer m.relayClientsMutex.Unlock()
|
||||
return len(m.relayClients)
|
||||
}
|
||||
|
||||
func (m *Manager) cleanUpUnusedRelays() {
|
||||
m.relayClientsMutex.Lock()
|
||||
defer m.relayClientsMutex.Unlock()
|
||||
|
||||
@@ -292,8 +292,8 @@ func TestForeginAutoClose(t *testing.T) {
|
||||
timeout := relayCleanupInterval + keepUnusedServerTime + 1*time.Second
|
||||
t.Logf("waiting for relay cleanup: %s", timeout)
|
||||
time.Sleep(timeout)
|
||||
if len(mgr.relayClients) != 0 {
|
||||
t.Errorf("expected 0, got %d", len(mgr.relayClients))
|
||||
if mgr.getClientLen() != 0 {
|
||||
t.Errorf("expected 0, got %d", mgr.getClientLen())
|
||||
}
|
||||
|
||||
t.Logf("closing manager")
|
||||
|
||||
Reference in New Issue
Block a user