SocketExceptions that are thrown during shut down of the socket should not bubble up.

Fixes PR #86.
This commit is contained in:
drieseng
2016-09-18 19:17:04 +02:00
parent f9773a6786
commit ee9f0f748a
3 changed files with 34 additions and 6 deletions
@@ -132,7 +132,15 @@ namespace Renci.SshNet.Channels
if (!_socket.IsConnected())
return;
_socket.Shutdown(how);
try
{
_socket.Shutdown(how);
}
catch (SocketException ex)
{
// TODO: log as warning
DiagnosticAbstraction.Log("Failure shutting down socket: " + ex);
}
}
}
@@ -26,8 +26,20 @@ namespace Renci.SshNet.Channels
/// <param name="remoteChannelNumber">The remote channel number.</param>
/// <param name="remoteWindowSize">The window size of the remote party.</param>
/// <param name="remotePacketSize">The maximum size of a data packet that we can send to the remote party.</param>
internal ChannelForwardedTcpip(ISession session, uint localChannelNumber, uint localWindowSize, uint localPacketSize, uint remoteChannelNumber, uint remoteWindowSize, uint remotePacketSize)
: base(session, localChannelNumber, localWindowSize, localPacketSize, remoteChannelNumber, remoteWindowSize, remotePacketSize)
internal ChannelForwardedTcpip(ISession session,
uint localChannelNumber,
uint localWindowSize,
uint localPacketSize,
uint remoteChannelNumber,
uint remoteWindowSize,
uint remotePacketSize)
: base(session,
localChannelNumber,
localWindowSize,
localPacketSize,
remoteChannelNumber,
remoteWindowSize,
remotePacketSize)
{
}
@@ -116,7 +128,15 @@ namespace Renci.SshNet.Channels
if (!socket.IsConnected())
return;
socket.Shutdown(how);
try
{
socket.Shutdown(how);
}
catch (SocketException ex)
{
// TODO: log as warning
DiagnosticAbstraction.Log("Failure shutting down socket: " + ex);
}
}
}
+2 -2
View File
@@ -1796,8 +1796,8 @@ namespace Renci.SshNet
}
catch (SocketException ex)
{
// TODO: log as info or debug
DiagnosticAbstraction.Log("Failure shutting down socket or clearing read buffer: " + ex);
// TODO: log as warning
DiagnosticAbstraction.Log("Failure shutting down socket: " + ex);
}
}