diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-07-11 17:48:27 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-07-11 17:48:27 -0500 |
| commit | 187510e6418a500fbf99ff0765ef2794100bf06a (patch) | |
| tree | 467acb0c55f8d37095cddfdc52d927d2daf99c34 /src | |
| parent | bab00cb022cc8d50e84e4e8bec40b92b7f60983a (diff) | |
| download | slskd-187510e6418a500fbf99ff0765ef2794100bf06a.tar.gz | |
trap cancellation exceptions
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/ConnectionWatchdog.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs index a598ff7a..9964514b 100644 --- a/src/slskd/Core/ConnectionWatchdog.cs +++ b/src/slskd/Core/ConnectionWatchdog.cs @@ -209,6 +209,12 @@ namespace slskd break; } + catch (Exception ex) when (ex is TaskCanceledException || ex is OperationCanceledException) + { + Log.Information("Reconnection attempt cancelled"); + Log.Debug(ex, "ConnectAsync() threw {Exception}", ex); + return; + } catch (Exception ex) { attempts++; @@ -216,6 +222,15 @@ namespace slskd } } } + catch (Exception ex) when (ex is TaskCanceledException || ex is OperationCanceledException) + { + Log.Information("Reconnection attempt cancelled"); + Log.Debug(ex, "Reconnect logic threw {Exception}", ex); + } + catch (Exception ex) + { + Log.Warning(ex, "Reconnect attempt failed: {Message}", ex.Message); + } finally { CancellationTokenSource?.Dispose(); |
