You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do not send SSH_MSG_DISCONNECT when the server is closing the session by sending a SSH_MSG_DISCONNECT.
Reduces - but does not eliminate - likelyhood of race condition when remote server and client attempt to disconnect at the same time.
Currently this leads to a NRE or ObjectDisposedException in Session.IsSocketConnected(ref bool isConnected) when one thread is attempting to check whether the socket is still connected, and the other thread is disposing the socket.
This commit just reduces the likelyhood as the message loop thread that handes the SSH_MSG_DISCONNECT sent by the server will no longer attempt to send a SSH_MSG_DISCONNECT to the server, and as such will not check whether the socket is still connected.
// transition to disconnecting state to avoid throwing exceptions while cleaning up, and to
1256
+
// ensure any exceptions that are raised do not overwrite the SshConnectionException that we
1257
+
// set below
1258
+
_isDisconnecting=true;
1259
+
1256
1260
_exception=newSshConnectionException(string.Format(CultureInfo.InvariantCulture,"The connection was closed by the server: {0} ({1}).",message.Description,message.ReasonCode),message.ReasonCode);
0 commit comments