diff --git a/src/Renci.SshNet/ISession.cs b/src/Renci.SshNet/ISession.cs index 6d988766..cd950da5 100644 --- a/src/Renci.SshNet/ISession.cs +++ b/src/Renci.SshNet/ISession.cs @@ -156,8 +156,27 @@ namespace Renci.SshNet /// void WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout); + /// + /// Waits for the specified to receive a signal, using a + /// to specify the time interval. + /// + /// The that should be signaled. + /// A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely. + /// When this method returns , contains the . + /// + /// A . + /// WaitResult TryWait(WaitHandle waitHandle, TimeSpan timeout, out Exception exception); + /// + /// Waits for the specified to receive a signal, using a + /// to specify the time interval. + /// + /// The that should be signaled. + /// A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely. + /// + /// A . + /// WaitResult TryWait(WaitHandle waitHandle, TimeSpan timeout); /// diff --git a/src/Renci.SshNet/Session.cs b/src/Renci.SshNet/Session.cs index 33af7656..3e0143b4 100644 --- a/src/Renci.SshNet/Session.cs +++ b/src/Renci.SshNet/Session.cs @@ -268,7 +268,7 @@ namespace Renci.SshNet /// The is disposed. /// /// - /// The SSH_MSG_DISCONNECT message - which is used to disconnect from the server - has been sent. + /// The SSH_MSG_DISCONNECT message - which is used to disconnect from the server - has been sent. /// /// /// The client has not been authenticated successfully. @@ -798,17 +798,46 @@ namespace Renci.SshNet WaitOnHandle(waitHandle, ConnectionInfo.Timeout); } + /// + /// Waits for the specified to receive a signal, using a + /// to specify the time interval. + /// + /// The that should be signaled. + /// A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely. + /// + /// A . + /// WaitResult ISession.TryWait(WaitHandle waitHandle, TimeSpan timeout) { Exception exception; return TryWait(waitHandle, timeout, out exception); } + /// + /// Waits for the specified to receive a signal, using a + /// to specify the time interval. + /// + /// The that should be signaled. + /// A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely. + /// When this method returns , contains the . + /// + /// A . + /// WaitResult ISession.TryWait(WaitHandle waitHandle, TimeSpan timeout, out Exception exception) { return TryWait(waitHandle, timeout, out exception); } + /// + /// Waits for the specified to receive a signal, using a + /// to specify the time interval. + /// + /// The that should be signaled. + /// A that represents the number of milliseconds to wait, or a that represents -1 milliseconds to wait indefinitely. + /// When this method returns , contains the . + /// + /// A . + /// private WaitResult TryWait(WaitHandle waitHandle, TimeSpan timeout, out Exception exception) { if (waitHandle == null) @@ -1157,7 +1186,7 @@ namespace Renci.SshNet _isDisconnectMessageSent = true; } -#region Handle received message events + #region Handle received message events /// /// Called when received. @@ -1579,7 +1608,7 @@ namespace Renci.SshNet handlers(this, new MessageEventArgs(message)); } -#endregion + #endregion private void KeyExchange_HostKeyReceived(object sender, HostKeyEventArgs e) { @@ -1588,7 +1617,7 @@ namespace Renci.SshNet handlers(this, e); } -#region Message loading functions + #region Message loading functions /// /// Registers SSH message with the session. @@ -1653,7 +1682,7 @@ namespace Renci.SshNet return ToHex(bytes, 0); } -#endregion + #endregion /// /// Establishes a socket connection to the specified host and port. @@ -2322,7 +2351,7 @@ namespace Renci.SshNet DisconnectReason.ConnectionLost); } -#region IDisposable implementation + #region IDisposable implementation private bool _disposed; @@ -2413,9 +2442,9 @@ namespace Renci.SshNet Dispose(false); } -#endregion IDisposable implementation + #endregion IDisposable implementation -#region ISession implementation + #region ISession implementation /// /// Gets or sets the connection info. @@ -2501,14 +2530,32 @@ namespace Renci.SshNet return TrySendMessage(message); } -#endregion ISession implementation + #endregion ISession implementation } + /// + /// Represents the result of a wait operations. + /// internal enum WaitResult { + /// + /// The was signaled within the specified interval. + /// Success = 1, + + /// + /// The was not signaled within the specified interval. + /// TimedOut = 2, + + /// + /// The session is in a disconnected state. + /// Disconnected = 3, + + /// + /// The session is in a failed state. + /// Failed = 4 } } \ No newline at end of file