Do not catching exceptions while clearing read buffer of socket.

Leave this up to the caller.
This commit is contained in:
drieseng
2016-09-07 21:34:12 +02:00
parent c274f1f9b5
commit 77e7bc8c04
@@ -81,20 +81,15 @@ namespace Renci.SshNet.Abstractions
public static void ClearReadBuffer(Socket socket)
{
try
{
var buffer = new byte[256];
int bytesReceived;
var timeout = TimeSpan.FromMilliseconds(10);
var buffer = new byte[256];
int bytesReceived;
do
{
bytesReceived = ReadPartial(socket, buffer, 0, buffer.Length, TimeSpan.FromMilliseconds(10));
} while (bytesReceived > 0);
}
catch
do
{
// ignore any exceptions
bytesReceived = ReadPartial(socket, buffer, 0, buffer.Length, timeout);
}
while (bytesReceived > 0);
}
public static int ReadPartial(Socket socket, byte[] buffer, int offset, int size, TimeSpan timeout)