浏览代码

Rename WaitHandle method to WaitOnHandle to avoid naming clash with WaitHandle class.

Gert Driesen 11 年之前
父节点
当前提交
108b20965c

+ 1 - 0
Renci.SshClient/Build/nuget/SSH.NET.nuspec

@@ -22,6 +22,7 @@ Breaking changes:
 
 Fixes:
 
+	* Connection dropped by server due to invalid DSA signature (issue #1918)
     * Correct casing of Security/Cryptography/HMAC.cs to fix build on Linux (issue #1505)
     * HTTP proxy hangs (issue #1890)
     * Wrong parameters to SetSocketOption leads to SocketException under Mono (issue #1799)

+ 5 - 5
Renci.SshClient/Renci.SshNet/Channels/Channel.cs

@@ -442,7 +442,7 @@ namespace Renci.SshNet.Channels
                 }
 
                 //  Wait for window to change
-                this.WaitHandle(this._channelServerWindowAdjustWaitHandle);
+                this.WaitOnHandle(this._channelServerWindowAdjustWaitHandle);
 
             } while (true);
 
@@ -479,7 +479,7 @@ namespace Renci.SshNet.Channels
                 }
 
                 //  Wait for window to change
-                this.WaitHandle(this._channelServerWindowAdjustWaitHandle);
+                this.WaitOnHandle(this._channelServerWindowAdjustWaitHandle);
 
             } while (true);
 
@@ -490,9 +490,9 @@ namespace Renci.SshNet.Channels
         /// Waits for the handle to be signaled or for an error to occurs.
         /// </summary>
         /// <param name="waitHandle">The wait handle.</param>
-        protected void WaitHandle(WaitHandle waitHandle)
+        protected void WaitOnHandle(WaitHandle waitHandle)
         {
-            this._session.WaitHandle(waitHandle);
+            this._session.WaitOnHandle(waitHandle);
         }
 
         protected virtual void Close(bool wait)
@@ -514,7 +514,7 @@ namespace Renci.SshNet.Channels
             //  Wait for channel to be closed
             if (wait)
             {
-                this._session.WaitHandle(this._channelClosedWaitHandle);
+                this._session.WaitOnHandle(this._channelClosedWaitHandle);
             }
         }
 

+ 1 - 1
Renci.SshClient/Renci.SshNet/Channels/ChannelDirectTcpip.cs

@@ -55,7 +55,7 @@ namespace Renci.SshNet.Channels
                                                         new DirectTcpipChannelInfo(remoteHost, port, ep.Address.ToString(), (uint)ep.Port)));
 
             //  Wait for channel to open
-            this.WaitHandle(this._channelOpen);
+            this.WaitOnHandle(this._channelOpen);
         }
 
         /// <summary>

+ 10 - 10
Renci.SshClient/Renci.SshNet/Channels/ChannelSession.cs

@@ -47,7 +47,7 @@ namespace Renci.SshNet.Channels
                 while (this._failedOpenAttempts < this.ConnectionInfo.RetryAttempts && !this.IsOpen)
                 {
                     this.SendChannelOpenMessage();
-                    this.WaitHandle(this._channelOpenResponseWaitHandle);
+                    this.WaitOnHandle(this._channelOpenResponseWaitHandle);
                 }
 
                 if (!this.IsOpen)
@@ -127,7 +127,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new PseudoTerminalRequestInfo(environmentVariable, columns, rows, width, height, terminalModeValues)));
             
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }
@@ -146,7 +146,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new X11ForwardingRequestInfo(isSingleConnection, protocol, cookie, screenNumber)));
 
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }
@@ -163,7 +163,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new EnvironmentVariableRequestInfo(variableName, variableValue)));
 
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }
@@ -178,7 +178,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new ShellRequestInfo()));
 
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }
@@ -194,7 +194,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new ExecRequestInfo(command, this.ConnectionInfo.Encoding)));
 
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }
@@ -210,7 +210,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new BreakRequestInfo(breakLength)));
 
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }
@@ -226,7 +226,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new SubsystemRequestInfo(subsystem)));
 
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }
@@ -307,7 +307,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new EndOfWriteRequestInfo()));
 
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }
@@ -322,7 +322,7 @@ namespace Renci.SshNet.Channels
 
             this.SendMessage(new ChannelRequestMessage(this.RemoteChannelNumber, new KeepAliveRequestInfo()));
 
-            this.WaitHandle(this._channelRequestResponse);
+            this.WaitOnHandle(this._channelRequestResponse);
 
             return this._channelRequestSucces;
         }

+ 2 - 2
Renci.SshClient/Renci.SshNet/ForwardedPortRemote.cs

@@ -109,7 +109,7 @@ namespace Renci.SshNet
             //  Send global request to start direct tcpip
             this.Session.SendMessage(new GlobalRequestMessage(GlobalRequestName.TcpIpForward, true, this.BoundHost, this.BoundPort));
 
-            this.Session.WaitHandle(this._globalRequestResponse);
+            this.Session.WaitOnHandle(this._globalRequestResponse);
 
             if (!this._requestStatus)
             {
@@ -135,7 +135,7 @@ namespace Renci.SshNet
             //  Send global request to cancel direct tcpip
             this.Session.SendMessage(new GlobalRequestMessage(GlobalRequestName.CancelTcpIpForward, true, this.BoundHost, this.BoundPort));
 
-            this.Session.WaitHandle(this._globalRequestResponse);
+            this.Session.WaitOnHandle(this._globalRequestResponse);
 
             this.Session.RequestSuccessReceived -= Session_RequestSuccess;
             this.Session.RequestFailureReceived -= Session_RequestFailure;

+ 1 - 1
Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs

@@ -63,7 +63,7 @@ namespace Renci.SshNet
 
             session.SendMessage(this._requestMessage);
 
-            session.WaitHandle(this._authenticationCompleted);
+            session.WaitOnHandle(this._authenticationCompleted);
 
             session.UnRegisterMessage("SSH_MSG_USERAUTH_INFO_REQUEST");
 

+ 3 - 3
Renci.SshClient/Renci.SshNet/Netconf/NetConfSession.cs

@@ -77,13 +77,13 @@ namespace Renci.SshNet.NetConf
                 command.Append("\n##\n");
                 this.SendData(Encoding.UTF8.GetBytes(command.ToString()));
 
-                this.WaitHandle(this._rpcReplyReceived, this._operationTimeout);
+                this.WaitOnHandle(this._rpcReplyReceived, this._operationTimeout);
                 reply.LoadXml(_rpcReply.ToString());
             }
             else
             {
                 this.SendData(Encoding.UTF8.GetBytes(rpc.InnerXml + _prompt));
-                this.WaitHandle(this._rpcReplyReceived, this._operationTimeout);
+                this.WaitOnHandle(this._rpcReplyReceived, this._operationTimeout);
                 reply.LoadXml(_rpcReply.ToString());
             }
             if (automaticMessageIdHandling)
@@ -106,7 +106,7 @@ namespace Renci.SshNet.NetConf
 
             this.SendData(Encoding.UTF8.GetBytes(message));
 
-            this.WaitHandle(this._serverCapabilitiesConfirmed, this._operationTimeout);
+            this.WaitOnHandle(this._serverCapabilitiesConfirmed, this._operationTimeout);
         }
 
         protected override void OnDataReceived(uint dataTypeCode, byte[] data)

+ 1 - 1
Renci.SshClient/Renci.SshNet/NoneAuthenticationMethod.cs

@@ -52,7 +52,7 @@ namespace Renci.SshNet
 
             session.SendMessage(new RequestMessageNone(ServiceName.Connection, this.Username));
 
-            session.WaitHandle(this._authenticationCompleted);
+            session.WaitOnHandle(this._authenticationCompleted);
 
             session.UserAuthenticationSuccessReceived -= Session_UserAuthenticationSuccessReceived;
             session.UserAuthenticationFailureReceived -= Session_UserAuthenticationFailureReceived;

+ 1 - 1
Renci.SshClient/Renci.SshNet/PasswordAuthenticationMethod.cs

@@ -91,7 +91,7 @@ namespace Renci.SshNet
 
             session.SendMessage(this._requestMessage);
 
-            session.WaitHandle(this._authenticationCompleted);
+            session.WaitOnHandle(this._authenticationCompleted);
             
             session.UserAuthenticationSuccessReceived -= Session_UserAuthenticationSuccessReceived;
             session.UserAuthenticationFailureReceived -= Session_UserAuthenticationFailureReceived;

+ 2 - 2
Renci.SshClient/Renci.SshNet/PrivateKeyAuthenticationMethod.cs

@@ -81,7 +81,7 @@ namespace Renci.SshNet
                 //  Send public key authentication request
                 session.SendMessage(message);
 
-                session.WaitHandle(this._authenticationCompleted);
+                session.WaitOnHandle(this._authenticationCompleted);
 
                 if (this._isSignatureRequired)
                 {
@@ -97,7 +97,7 @@ namespace Renci.SshNet
                     session.SendMessage(signatureMessage);
                 }
 
-                session.WaitHandle(this._authenticationCompleted);
+                session.WaitOnHandle(this._authenticationCompleted);
 
                 if (this._authenticationResult == AuthenticationResult.Success)
                 {

+ 8 - 8
Renci.SshClient/Renci.SshNet/Session.cs

@@ -529,7 +529,7 @@ namespace Renci.SshNet
                     });
 
                     //  Wait for key exchange to be completed
-                    this.WaitHandle(this._keyExchangeCompletedWaitHandle);
+                    this.WaitOnHandle(this._keyExchangeCompletedWaitHandle);
 
                     //  If sessionId is not set then its not connected
                     if (this.SessionId == null)
@@ -542,7 +542,7 @@ namespace Renci.SshNet
                     this.SendMessage(new ServiceRequestMessage(ServiceName.UserAuthentication));
 
                     //  Wait for service to be accepted
-                    this.WaitHandle(this._serviceAccepted);
+                    this.WaitOnHandle(this._serviceAccepted);
 
                     if (string.IsNullOrEmpty(this.ConnectionInfo.Username))
                     {
@@ -620,19 +620,19 @@ namespace Renci.SshNet
         /// Waits for handle to signal while checking other handles as well including timeout check to prevent waiting for ever
         /// </summary>
         /// <param name="waitHandle">The wait handle.</param>
-        internal void WaitHandle(WaitHandle waitHandle)
+        internal void WaitOnHandle(WaitHandle waitHandle)
         {
-            var waitHandles = new WaitHandle[]
+            var waitHandles = new[]
                 {
                     this._exceptionWaitHandle,
-                    waitHandle,
+                    waitHandle
                 };
 
-            switch (EventWaitHandle.WaitAny(waitHandles, this.ConnectionInfo.Timeout))
+            switch (WaitHandle.WaitAny(waitHandles, this.ConnectionInfo.Timeout))
             {
                 case 0:
                     throw this._exception;
-                case System.Threading.WaitHandle.WaitTimeout:
+                case WaitHandle.WaitTimeout:
                     this.SendDisconnect(DisconnectReason.ByApplication, "Operation timeout");
                     throw new SshOperationTimeoutException("Session operation has timed out");
             }
@@ -650,7 +650,7 @@ namespace Renci.SshNet
             if (this._keyExchangeInProgress && !(message is IKeyExchangedAllowed))
             {
                 //  Wait for key exchange to be completed
-                this.WaitHandle(this._keyExchangeCompletedWaitHandle);
+                this.WaitOnHandle(this._keyExchangeCompletedWaitHandle);
             }
 
             this.Log(string.Format("SendMessage to server '{0}': '{1}'.", message.GetType().Name, message));

+ 23 - 23
Renci.SshClient/Renci.SshNet/Sftp/SftpSession.cs

@@ -158,7 +158,7 @@ namespace Renci.SshNet.Sftp
         {
             this.SendMessage(new SftpInitRequest(MAXIMUM_SUPPORTED_VERSION));
 
-            this.WaitHandle(this._sftpVersionConfirmed, this._operationTimeout);
+            this.WaitOnHandle(this._sftpVersionConfirmed, this._operationTimeout);
 
             if (this.ProtocolVersion > MAXIMUM_SUPPORTED_VERSION || this.ProtocolVersion < MINIMUM_SUPPORTED_VERSION)
             {
@@ -276,7 +276,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (!nullOnError && exception != null)
@@ -306,7 +306,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -347,7 +347,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -386,7 +386,7 @@ namespace Renci.SshNet.Sftp
             this.SendRequest(request);
 
             if (wait != null)
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
 
             if (exception != null)
             {
@@ -423,7 +423,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -463,7 +463,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -494,7 +494,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -523,7 +523,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -560,7 +560,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (!nullOnError && exception != null)
@@ -601,7 +601,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -631,7 +631,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -659,7 +659,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -687,7 +687,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -724,7 +724,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (!nullOnError && exception != null)
@@ -765,7 +765,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (!nullOnError && exception != null)
@@ -801,7 +801,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -844,7 +844,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (!nullOnError && exception != null)
@@ -880,7 +880,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -921,7 +921,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)
@@ -967,7 +967,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (!nullOnError && exception != null)
@@ -1016,7 +1016,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
             
             if (!nullOnError && exception != null)
@@ -1055,7 +1055,7 @@ namespace Renci.SshNet.Sftp
 
                 this.SendRequest(request);
 
-                this.WaitHandle(wait, this._operationTimeout);
+                this.WaitOnHandle(wait, this._operationTimeout);
             }
 
             if (exception != null)

+ 1 - 1
Renci.SshClient/Renci.SshNet/SftpClient.cs

@@ -1523,7 +1523,7 @@ namespace Renci.SshNet
                 else if (expectedResponses > 0)
                 {
                     //  Wait for expectedResponses to change
-                    this._sftpSession.WaitHandle(responseReceivedWaitHandle, this.OperationTimeout);
+                    this._sftpSession.WaitOnHandle(responseReceivedWaitHandle, this.OperationTimeout);
                 }
             } while (expectedResponses > 0 || bytesRead > 0);
 

+ 2 - 2
Renci.SshClient/Renci.SshNet/ShellStream.cs

@@ -694,9 +694,9 @@ namespace Renci.SshNet
         /// Waits for the handle to be signaled or for an error to occurs.
         /// </summary>
         /// <param name="waitHandle">The wait handle.</param>
-        protected void WaitHandle(WaitHandle waitHandle)
+        protected void WaitOnHandle(WaitHandle waitHandle)
         {
-            this._session.WaitHandle(waitHandle);
+            this._session.WaitOnHandle(waitHandle);
         }
 
         partial void ExecuteThread(Action action);

+ 5 - 5
Renci.SshClient/Renci.SshNet/SshCommand.cs

@@ -282,7 +282,7 @@ namespace Renci.SshNet
                     if (this._asyncResult != null)
                     {
                         //  Make sure that operation completed if not wait for it to finish
-                        this.WaitHandle(this._asyncResult.AsyncWaitHandle);
+                        this.WaitOnHandle(this._asyncResult.AsyncWaitHandle);
 
                         if (this._channel.IsOpen)
                         {
@@ -469,19 +469,19 @@ namespace Renci.SshNet
 
         /// <exception cref="SshOperationTimeoutException">Command '{0}' has timed out.</exception>
         /// <remarks>The actual command will be included in the exception message.</remarks>
-        private void WaitHandle(WaitHandle waitHandle)
+        private void WaitOnHandle(WaitHandle waitHandle)
         {
-            var waitHandles = new WaitHandle[]
+            var waitHandles = new[]
                 {
                     this._sessionErrorOccuredWaitHandle,
                     waitHandle
                 };
 
-            switch (EventWaitHandle.WaitAny(waitHandles, this.CommandTimeout))
+            switch (WaitHandle.WaitAny(waitHandles, this.CommandTimeout))
             {
                 case 0:
                     throw this._exception;
-                case System.Threading.WaitHandle.WaitTimeout:
+                case WaitHandle.WaitTimeout:
                     throw new SshOperationTimeoutException(string.Format(CultureInfo.CurrentCulture, "Command '{0}' has timed out.", this.CommandText));
             }
         }

+ 4 - 4
Renci.SshClient/Renci.SshNet/SubsystemSession.cs

@@ -150,22 +150,22 @@ namespace Renci.SshNet.Sftp
             this._channelClosedWaitHandle.Set();
         }
 
-        internal void WaitHandle(WaitHandle waitHandle, TimeSpan operationTimeout)
+        internal void WaitOnHandle(WaitHandle waitHandle, TimeSpan operationTimeout)
         {
-            var waitHandles = new WaitHandle[]
+            var waitHandles = new[]
                 {
                     this._errorOccuredWaitHandle,
                     this._channelClosedWaitHandle,
                     waitHandle
                 };
 
-            switch (EventWaitHandle.WaitAny(waitHandles, operationTimeout))
+            switch (WaitHandle.WaitAny(waitHandles, operationTimeout))
             {
                 case 0:
                     throw this._exception;
                 case 1:
                     throw new SshException("Channel was closed.");
-                case System.Threading.WaitHandle.WaitTimeout:
+                case WaitHandle.WaitTimeout:
                     throw new SshOperationTimeoutException(string.Format(CultureInfo.CurrentCulture, "Operation has timed out."));
             }
         }