2
0
Эх сурвалжийг харах

For now, remove SocketRead overload that takes timeout as on .NET do not support this yet.
Document fix for issue #1935 and #2223.

Gert Driesen 11 жил өмнө
parent
commit
b40adc2f40

+ 48 - 46
Renci.SshClient/Build/nuget/SSH.NET.nuspec

@@ -10,63 +10,65 @@
         <projectUrl>http://sshnet.codeplex.com/</projectUrl>
         <requireLicenseAcceptance>true</requireLicenseAcceptance>
         <description>This project was inspired by Sharp.SSH library which was ported from Java.  This library is a complete rewrite using .NET, without any third party dependencies and to utilize the parallelism as much as possible to allow best performance you can get.  SSH.NET supports .NET 3.5, .NET 4.0, Silverlight 4.0, Silverlight 5.0, Windows Phone 7.1 and Windows Phone 8.</description>
-        <releaseNotes>2014.4.6-beta2
-==============
+        <releaseNotes>
+          2014.4.6-beta2
+          ==============
 
-New Features:
+          New Features:
 
-    * Improved accuracy of IsConnected on .NET
-    * Added support for ssh.com (SSH-2) private keys (issue #1987)
-    * Support an acceptable group of up to 8192 bits for SHA-1 and SHA-256 Diffie-Hellman Group and Key Exchange (issues #1973 and #1777)
+          * Improved accuracy of IsConnected on .NET
+          * Added support for ssh.com (SSH-2) private keys (issue #1987)
+          * Support an acceptable group of up to 8192 bits for SHA-1 and SHA-256 Diffie-Hellman Group and Key Exchange (issues #1973 and #1777)
 
-Fixes:
+          Fixes:
 
-    * Client channels are no longer closed on dispose (issue #1943)
-    * SftpClient.Exists(string) returns true for a path that does not exist (issues #1952, #1696 and #1574)
-    * ObjectDisposedException when channel is closing (issues #1942 and #1944)
-    * Stack overflow during authentication when server returns same allowed methods after partial success (issue #2399)
-    * SshCommand doesn't cleanup subscribed events (issue #2295)
+          * Client channels are no longer closed on dispose (issue #1943)
+          * SftpClient.Exists(string) returns true for a path that does not exist (issues #1952, #1696 and #1574)
+          * ObjectDisposedException when channel is closing (issues #1942 and #1944)
+          * Stack overflow during authentication when server returns same allowed methods after partial success (issue #2399)
+          * SshCommand doesn't cleanup subscribed events (issue #2295)
+          * Lines before protocol identification string are not skipped (issue #1935 and #2223)
 
-2014.4.6-beta1
-==============
+          2014.4.6-beta1
+          ==============
 
-New Features:
+          New Features:
 
-    * Added callbacks to UploadFile, DownloadFile and ListDirectory in SftpClient (issue #1324)
-    * Allow a given private key file to be used concurrently
-    * Performance improvements:
-        - optimization of payload size for both read and write operations (SftpClient only)
-        - increase window size from 1MB to 2MB
-        - increase buffer size from 16KB to 64KB for SftpClient
-        - take into account the maximum remote packet size of the channel for write operations
-        - increase maximum size of packets that we can receive from 32 KB to 64 KB
-    * Improve exception message for authentication failures
+          * Added callbacks to UploadFile, DownloadFile and ListDirectory in SftpClient (issue #1324)
+          * Allow a given private key file to be used concurrently
+          * Performance improvements:
+          - optimization of payload size for both read and write operations (SftpClient only)
+          - increase window size from 1MB to 2MB
+          - increase buffer size from 16KB to 64KB for SftpClient
+          - take into account the maximum remote packet size of the channel for write operations
+          - increase maximum size of packets that we can receive from 32 KB to 64 KB
+          * Improve exception message for authentication failures
 
-Breaking changes:
+          Breaking changes:
 
-    * Assembly name is now Renci.SshNet for all supported frameworks
-    * The Renci.SshNet assemblies for .NET and Silverlight are now strong-named (issue #1802)
+          * Assembly name is now Renci.SshNet for all supported frameworks
+          * The Renci.SshNet assemblies for .NET and Silverlight are now strong-named (issue #1802)
 
-Fixes:
+          Fixes:
 
-    * Incorrect copyright in assemblies (issue #1764)
-    * Remove linefeed from WriteLine method in Shellstream class (issue #1584)
-    * Disable logging of messages in release builds (issue #1767)
-    * Stuck loop on key exchange using arcfour encryption (issue #1922)
-    * Timeout sending data to server with low window size (issue #1706)
-    * No connection possible with the same auth method requested multiple times (issue #1930)
-    * Unobserved exception rethrown by finalizer thread (issue #1298 and #1587)
-    * Client cipher is used to decrypt server messages (issue #1917)
-    * 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)
-    * Incorrect check for timeout values (issue #1620)
-    * Wrong PKCS7 padding in DES algorithm (issue #1580)
-    * OverflowException on empty server response (issue #1562)
-    * Event handle leak (issue #1761)
-    * SftpFileStream is very slow (issue #1919)
-    * Write access required for private key file</releaseNotes>
+          * Incorrect copyright in assemblies (issue #1764)
+          * Remove linefeed from WriteLine method in Shellstream class (issue #1584)
+          * Disable logging of messages in release builds (issue #1767)
+          * Stuck loop on key exchange using arcfour encryption (issue #1922)
+          * Timeout sending data to server with low window size (issue #1706)
+          * No connection possible with the same auth method requested multiple times (issue #1930)
+          * Unobserved exception rethrown by finalizer thread (issue #1298 and #1587)
+          * Client cipher is used to decrypt server messages (issue #1917)
+          * 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)
+          * Incorrect check for timeout values (issue #1620)
+          * Wrong PKCS7 padding in DES algorithm (issue #1580)
+          * OverflowException on empty server response (issue #1562)
+          * Event handle leak (issue #1761)
+          * SftpFileStream is very slow (issue #1919)
+          * Write access required for private key file</releaseNotes>
         <summary>A Secure Shell (SSH) library for .NET, optimized for parallelism.</summary>
         <copyright>2012-2014, RENCI</copyright>
         <language>en-US</language>

+ 5 - 2
Renci.SshClient/Renci.SshNet.Silverlight/Session.SilverlightShared.cs

@@ -15,6 +15,7 @@ namespace Renci.SshNet
         private const byte Null = 0x00;
         private const byte CarriageReturn = 0x0d;
         private const byte LineFeed = 0x0a;
+        private static readonly TimeSpan Infinite = new TimeSpan(0, 0, 0, 0, -1);
 
         private readonly AutoResetEvent _connectEvent = new AutoResetEvent(false);
         private readonly AutoResetEvent _sendEvent = new AutoResetEvent(false);
@@ -123,12 +124,12 @@ namespace Renci.SshNet
         /// </summary>
         /// <param name="length">The number of bytes to read.</param>
         /// <param name="buffer">The buffer to read to.</param>
-        /// <param name="timeout">A <see cref="TimeSpan"/> that represents the time to wait until <paramref name="length"/> bytes a read.</param>
         /// <exception cref="SshConnectionException">The socket is closed.</exception>
         /// <exception cref="SshOperationTimeoutException">The read has timed-out.</exception>
         /// <exception cref="SocketException">The read failed.</exception>
-        partial void SocketRead(int length, ref byte[] buffer, TimeSpan timeout)
+        partial void SocketRead(int length, ref byte[] buffer)
         {
+            var timeout = Infinite;
             var totalBytesReceived = 0;  // how many bytes are already received
 
             do
@@ -138,6 +139,8 @@ namespace Renci.SshNet
                 if (_socket.ReceiveAsync(args))
                 {
                     if (!_receiveEvent.WaitOne(timeout))
+                        // currently we wait indefinitely, so this exception will never be thrown
+                        // but let's leave this here anyway as we may revisit this later
                         throw new SshOperationTimeoutException(string.Format(CultureInfo.InvariantCulture,
                             "Socket read operation has timed out after {0:F0} milliseconds.", timeout.TotalMilliseconds));
                 }

+ 1 - 3
Renci.SshClient/Renci.SshNet/Session.NET.cs

@@ -180,11 +180,9 @@ namespace Renci.SshNet
         /// </summary>
         /// <param name="length">The number of bytes to read.</param>
         /// <param name="buffer">The buffer to read to.</param>
-        /// <param name="timeout">A <see cref="TimeSpan"/> that represents the time to wait until <paramref name="length"/> bytes a read.</param>
         /// <exception cref="SshConnectionException">The socket is closed.</exception>
-        /// <exception cref="SshOperationTimeoutException">The read has timed-out.</exception>
         /// <exception cref="SocketException">The read failed.</exception>
-        partial void SocketRead(int length, ref byte[] buffer, TimeSpan timeout)
+        partial void SocketRead(int length, ref byte[] buffer)
         {
             var receivedTotal = 0;  // how many bytes is already received
 

+ 4 - 14
Renci.SshClient/Renci.SshNet/Session.cs

@@ -1689,20 +1689,8 @@ namespace Renci.SshNet
         /// <param name="buffer">The buffer to read to.</param>
         /// <exception cref="SshConnectionException">The socket is closed.</exception>
         /// <exception cref="SshOperationTimeoutException">The read has timed-out.</exception>
-        private void SocketRead(int length, ref byte[] buffer)
-        {
-            SocketRead(length, ref buffer, ConnectionInfo.Timeout);
-        }
-
-        /// <summary>
-        /// Performs a blocking read on the socket until <paramref name="length"/> bytes are received.
-        /// </summary>
-        /// <param name="length">The number of bytes to read.</param>
-        /// <param name="buffer">The buffer to read to.</param>
-        /// <param name="timeout">A <see cref="TimeSpan"/> that represents the time to wait until <paramref name="length"/> bytes a read.</param>
-        /// <exception cref="SshConnectionException">The socket is closed.</exception>
-        /// <exception cref="SshOperationTimeoutException">The read has timed-out.</exception>
-        partial void SocketRead(int length, ref byte[] buffer, TimeSpan timeout);
+        /// <exception cref="SocketException">The read failed.</exception>
+        partial void SocketRead(int length, ref byte[] buffer);
 
         /// <summary>
         /// Performs a blocking read on the socket until a line is read.
@@ -1710,6 +1698,7 @@ namespace Renci.SshNet
         /// <param name="response">The line read from the socket, or <c>null</c> when the remote server has shutdown and all data has been received.</param>
         /// <param name="timeout">A <see cref="TimeSpan"/> that represents the time to wait until a line is read.</param>
         /// <exception cref="SshOperationTimeoutException">The read has timed-out.</exception>
+        /// <exception cref="SocketException">An error occurred when trying to access the socket.</exception>
         partial void SocketReadLine(ref string response, TimeSpan timeout);
 
         partial void Log(string text);
@@ -1719,6 +1708,7 @@ namespace Renci.SshNet
         /// </summary>
         /// <param name="data">The data to write to the server.</param>
         /// <exception cref="SshOperationTimeoutException">The write has timed-out.</exception>
+        /// <exception cref="SocketException">The write failed.</exception>
         partial void SocketWrite(byte[] data);
 
         /// <summary>