Sfoglia il codice sorgente

Rename SendDisconnect to TrySendDisconnect.

drieseng 9 anni fa
parent
commit
879c39badd
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3 2
      src/Renci.SshNet/Session.cs

+ 3 - 2
src/Renci.SshNet/Session.cs

@@ -700,7 +700,7 @@ namespace Renci.SshNet
             // the server should respond by closing the socket
             if (IsConnected)
             {
-                SendDisconnect(reason, message);
+                TrySendDisconnect(reason, message);
             }
 
             // disconnect socket, and dispose it
@@ -1030,13 +1030,14 @@ namespace Renci.SshNet
             return LoadMessage(data, messagePayloadOffset, messagePayloadLength);
         }
 
-        private void SendDisconnect(DisconnectReason reasonCode, string message)
+        private void TrySendDisconnect(DisconnectReason reasonCode, string message)
         {
             var disconnectMessage = new DisconnectMessage(reasonCode, message);
 
             // send the disconnect message, but ignore the outcome
             TrySendMessage(disconnectMessage);
 
+            // mark disconnect message sent regardless of whether the send sctually succeeded
             _isDisconnectMessageSent = true;
         }