Log warning upon timeout waiting for pending channels to reach zero.

This commit is contained in:
drieseng
2020-04-05 11:34:36 +02:00
parent 34df3dd725
commit 21c5c8e0b4
3 changed files with 18 additions and 7 deletions
+6 -1
View File
@@ -264,7 +264,12 @@ namespace Renci.SshNet
partial void InternalStop(TimeSpan timeout)
{
_pendingChannelCountdown.Signal();
_pendingChannelCountdown.Wait(timeout);
if (!_pendingChannelCountdown.Wait(timeout))
{
// TODO: log as warning
DiagnosticAbstraction.Log("Timeout waiting for pending channels in dynamic forwarded port to close.");
}
}
partial void InternalDispose(bool disposing)
+5 -1
View File
@@ -214,7 +214,11 @@ namespace Renci.SshNet
partial void InternalStop(TimeSpan timeout)
{
_pendingChannelCountdown.Signal();
_pendingChannelCountdown.Wait(timeout);
if (!_pendingChannelCountdown.Wait(timeout))
{
// TODO: log as warning
DiagnosticAbstraction.Log("Timeout waiting for pending channels in local forwarded port to close.");
}
}
partial void InternalDispose(bool disposing)
+7 -5
View File
@@ -201,7 +201,12 @@ namespace Renci.SshNet
// wait for pending channels to close
_pendingChannelCountdown.Signal();
_pendingChannelCountdown.Wait(timeout);
if (!_pendingChannelCountdown.Wait(timeout))
{
// TODO: log as warning
DiagnosticAbstraction.Log("Timeout waiting for pending channels in remote forwarded port to close.");
}
_status = ForwardedPortStatus.Stopped;
}
@@ -244,10 +249,7 @@ namespace Renci.SshNet
{
RaiseRequestReceived(info.OriginatorAddress, info.OriginatorPort);
using (
var channel =
Session.CreateChannelForwardedTcpip(channelOpenMessage.LocalChannelNumber,
channelOpenMessage.InitialWindowSize, channelOpenMessage.MaximumPacketSize))
using (var channel = Session.CreateChannelForwardedTcpip(channelOpenMessage.LocalChannelNumber, channelOpenMessage.InitialWindowSize, channelOpenMessage.MaximumPacketSize))
{
channel.Exception += Channel_Exception;
channel.Bind(new IPEndPoint(HostAddress, (int) Port), this);