Skip to content

Commit ad596e8

Browse files
committed
Remove clearing of buffer.
1 parent edde414 commit ad596e8

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

src/Renci.SshNet/Session.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,39 +1893,12 @@ private void SocketDisconnectAndDispose()
18931893
// closed by the remote host) which we'll log and ignore as it means the socket
18941894
// was already shut down
18951895
_socket.Shutdown(SocketShutdown.Send);
1896-
1897-
#if FEATURE_SOCKET_POLL
1898-
// since we've shut down the socket, there should not be any reads in progress but
1899-
// we still take a read lock to ensure IsSocketConnected continues to provide
1900-
// correct results
1901-
//
1902-
// see IsSocketConnected for details on the race condition we avoid with this lock
1903-
//
1904-
// this race condition only exists if IsSocketConnected actually uses Socket.Poll,
1905-
// and as such this read is also only required when Socket.Poll is available
1906-
lock (_socketReadLock)
1907-
{
1908-
#endif // FEATURE_SOCKET_POLL
1909-
SocketAbstraction.ClearReadBuffer(_socket);
1910-
#if FEATURE_SOCKET_POLL
1911-
}
1912-
#endif // FEATURE_SOCKET_POLL
1913-
}
1914-
catch (SshOperationTimeoutException ex)
1915-
{
1916-
// TODO: log as info or debug
1917-
DiagnosticAbstraction.Log("Time-out shutting down socket or clearing read buffer: " + ex);
19181896
}
19191897
catch (SocketException ex)
19201898
{
19211899
// TODO: log as info or debug
19221900
DiagnosticAbstraction.Log("Failure shutting down socket or clearing read buffer: " + ex);
19231901
}
1924-
catch (Exception ex)
1925-
{
1926-
// TODO: log as warning
1927-
DiagnosticAbstraction.Log("Time-out shutting down socket or clearing read buffer: " + ex);
1928-
}
19291902
}
19301903

19311904
DiagnosticAbstraction.Log(string.Format("[{0}] Disposing socket.", ToHex(SessionId)));

0 commit comments

Comments
 (0)