mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-10-27 03:59:24 +08:00
SocketExceptions that are thrown during shut down of the socket should not bubble up.
Fixes PR #86.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user