Skip to content

Commit

Permalink
Dispose non-reconnectable streams
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongin committed Aug 3, 2023
1 parent e69e8b0 commit 4ecfc51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions cs/src/Connections/TunnelClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,13 @@ private void OnForwardedPortAdded(PortForwardingService pfs, ForwardedPortEventA
lock (this.disconnectedStreams)
{
// The host is no longer accepting connections on the forwarded port?
// Clear the list of disconnected streams for the port, because
// it seems it is no longer possible to reconnect them.
streams.Clear();
// Dispose and clear the list of disconnected streams for the port,
// because it seems it is no longer possible to reconnect them.
while (streams.Count > 0)
{
streams[0].Dispose();
streams.RemoveAt(0);
}
}
}
});
Expand Down
4 changes: 3 additions & 1 deletion ts/src/connections/tunnelClientBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ export class TunnelClientBase
// it seems it is no longer possible to reconnect them.
const streams = this.disconnectedStreams.get(port);
if (streams) {
streams.splice(0, streams.length);
while (streams.length > 0) {
streams.pop()!.dispose();
}
}
});
}
Expand Down

0 comments on commit 4ecfc51

Please sign in to comment.