diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-11-15 18:31:31 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-11-15 18:31:31 -0600 |
| commit | 5da8ec43e7369656781df3bac8f894167529a50e (patch) | |
| tree | c678218d70b4a15bc64a20ec12bfe0cb5f776720 | |
| parent | b626a5716a8d810ebba66327d563538fb8f54ee5 (diff) | |
| download | slskd-5da8ec43e7369656781df3bac8f894167529a50e.tar.gz | |
ensure relay clients are disposed when switched
| -rw-r--r-- | src/slskd/Relay/RelayService.cs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/slskd/Relay/RelayService.cs b/src/slskd/Relay/RelayService.cs index 3ad36ed6..c063ceb2 100644 --- a/src/slskd/Relay/RelayService.cs +++ b/src/slskd/Relay/RelayService.cs @@ -858,6 +858,8 @@ namespace slskd.Relay else { // the controller changed. disconnect and throw away the client and create a new one + var oldClient = Client; + Client = new RelayClient( shareService: Shares, fileService: Files, @@ -867,6 +869,8 @@ namespace slskd.Relay Client.StateMonitor.OnChange(clientState => State.SetValue(state => state with { Controller = state.Controller with { State = clientState.Current } })); + oldClient.TryDispose(); + State.SetValue(state => state with { Mode = mode, |
