aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-07-11 17:48:44 -0500
committerJP Dillingham <jp@dillingham.me>2025-07-11 17:48:44 -0500
commit3ccc23f23d8604674690db1996c0922e2e255180 (patch)
treef80428cc88268624478b67deb695993ce5ddd38f /src
parent187510e6418a500fbf99ff0765ef2794100bf06a (diff)
downloadslskd-3ccc23f23d8604674690db1996c0922e2e255180.tar.gz
prevent throwing during finalization
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/ConnectionWatchdog.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs
index 9964514b..5001f024 100644
--- a/src/slskd/Core/ConnectionWatchdog.cs
+++ b/src/slskd/Core/ConnectionWatchdog.cs
@@ -233,7 +233,18 @@ namespace slskd
}
finally
{
- CancellationTokenSource?.Dispose();
+ var cts = CancellationTokenSource;
+ CancellationTokenSource = null;
+
+ try
+ {
+ cts?.Dispose();
+ }
+ catch (Exception)
+ {
+ // noop. i don't think this can throw, but if we fail to release the SyncRoot we'll be in trouble.
+ }
+
SyncRoot.Release();
}
}