diff --git a/src/Brunet/Collections/TimeBasedCache.cs b/src/Brunet/Collections/TimeBasedCache.cs index b281651d9..f6e2a73d4 100644 --- a/src/Brunet/Collections/TimeBasedCache.cs +++ b/src/Brunet/Collections/TimeBasedCache.cs @@ -161,7 +161,7 @@ public bool TryGetValue(K key, out V value, out bool update) /// Must stop the Recycling thread. public void Stop() { - if(System.Threading.Interlocked.Exchange(ref _stopped, 1) == 0) { + if(System.Threading.Interlocked.Exchange(ref _stopped, 1) == 1) { return; }