637 Commits

Author SHA1 Message Date
drieseng 5529efcab8 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.
2016-09-03 00:01:21 +02:00
drieseng c141c7d4a7 Ignore data of SSH_MSG_IGNORE when its specified length is greater than the actual available bytes.
Fixes issue #41.
2016-09-02 23:50:57 +02:00
drieseng 76a92cfb0a SshData.cs:
- Remove ZeroReaderIndex from SshData; offset should instead be specified when instance is created/loaded.
- LoadBytes is now private, and is always invoked when a message is loaded.
- Eliminate ResetReader().
SshDataStream.cs:
- Added overload taking buffer, offset and count.
KeyExchange*Message.cs:
- Remove ResetReader() calls.
Message.cs:
- Remove ZeroReaderIndex override.
SftpMessage.cs:
- Pass offset and count to Load overload to allow skipping byte representing the message type.
- Remove ZeroReaderIndex override.
SftpSession.cs:
- Avoid buffering when packet contains full SFTP response message.
Session.cs:
- Pass offset and count to Load overload to allow skipping offset bytes.
General:
- Temporarily add (too) verbose tracing.
2016-09-01 21:54:57 +02:00
drieseng bd2fa5d16f Use the managed thread id as identifier in our trace messages. 2016-08-23 18:26:43 +02:00
drieseng 31b2019fe4 Temporarily introduce extra verbose tracing. 2016-08-23 18:25:52 +02:00
drieseng 5260f1b73d Number of bytes in read buffer can never be negative. 2016-08-21 18:46:31 +02:00
drieseng ad56cc9bdf Take into account the offset in SftpFileStream.Write(byte[] buffer, int offset, int count) when not writing to the buffer. Fixes issue #70. 2016-08-21 18:14:03 +02:00
drieseng fb9fe50bc0 Fixed some tests after recent GlobalRequestMessage changes. 2016-08-15 21:36:37 +02:00
drieseng 546caedc94 Include session id in (some) trace messages. 2016-08-15 21:36:13 +02:00
drieseng 4442b88419 Removed unused import. 2016-08-15 12:56:50 +02:00
drieseng 5deccd0c0e Use ASCIIEncoding GetString overload that is supported on all target frameworks. 2016-08-15 12:55:23 +02:00
drieseng 820ed146cf Added new classes to all projects used in VS 2015 solution. 2016-08-15 12:54:52 +02:00
drieseng 96160b3c74 Added extra debug/trace output. 2016-08-15 12:49:31 +02:00
drieseng 5916656d66 Introduce specialized GlobalRequestMessage classes for tcpip-forward and cancel-tcpip-forward. 2016-08-15 12:48:40 +02:00
drieseng 7fce6e0b03 When receiving SSH_MSG_GLOBAL_REQUEST, only read data that is not message specific. Fixes issue #58. 2016-08-15 12:47:22 +02:00
drieseng 8a97fecddd Improve exception message when attempting to read more bytes than available. 2016-08-15 12:41:04 +02:00
drieseng 13cc56304a Prepare for stable release. 2016-08-01 21:05:02 +02:00
drieseng f4f6708f46 Give in to Resharper's urge to save "migrated" settings. 2016-07-31 11:45:57 +02:00
drieseng c5d51b9d9d Harden against "leaking" message registration.
Fixes issue #55.
2016-07-31 11:45:31 +02:00
drieseng 7e2836a7a7 Modify TryAuthenticate to static. 2016-07-31 11:39:26 +02:00
drieseng 07c2a6001f Code formatting. 2016-07-31 11:38:58 +02:00
drieseng 75d982bb09 Remove references to EncoderFallbackException and DecoderFallbackException. 2016-07-27 14:03:22 +02:00
drieseng f4a634f1d3 Minor (slash)doc improvements. 2016-07-27 13:52:31 +02:00
drieseng 76fdf58581 Improve slashdocs. 2016-07-27 12:52:50 +02:00
drieseng 563349d15a When the port is closing, first shutdown the send part of the socket.
Subsequently close/dispose the socket to ensure the blocking receive is interrupted.
2016-07-26 22:11:23 +02:00
drieseng 1e63a813cc Improved and corrected the slashdocs.
Fixed some typos.
2016-07-26 22:09:50 +02:00
drieseng bb4e719711 Added tests for SftpDownloadAsyncResult. 2016-07-26 19:53:00 +02:00
drieseng ae446661ef Use C# type. 2016-07-26 19:51:20 +02:00
drieseng 3598fcf3e4 Do not wrap exceptions in SshException. 2016-07-26 19:51:06 +02:00
drieseng db0300e00c Use C# types. 2016-07-26 19:25:47 +02:00
drieseng 1b28947a2d Attempt to harden test. 2016-07-26 14:44:10 +02:00
drieseng c0caf7dfa3 Harden tests. 2016-07-26 12:27:57 +02:00
drieseng 82c288b648 Harden test. 2016-07-24 22:53:21 +02:00
drieseng 590277f007 Harden test. 2016-07-24 22:33:44 +02:00
Gert Driesen 177812fac9 Merge pull request #49 from sshnet/develop
Prepare for beta 3
2016-07-24 22:08:35 +02:00
drieseng d71baa1811 Use portable pdb.
Fixes issue #48
2016-07-24 22:03:38 +02:00
drieseng 75f6911f72 Implement tests for Length and MaxBufferLength. 2016-07-24 21:11:34 +02:00
drieseng 81993af9d6 Disable null coalescing hint (as we need to support VS 2012 as well).
Code formatting updates.
2016-07-24 10:19:57 +02:00
drieseng 65bd07259a Stop listener before waiting for channels to close.
Remove extra exception handling.
2016-07-24 10:18:10 +02:00
drieseng 32becde5ad Mark port started before StartAccept because StartAccept is a noop when the port is not started. 2016-07-24 10:12:15 +02:00
drieseng f88509ed56 Ensure to mark port stopped when starting fails. 2016-07-24 10:05:51 +02:00
drieseng 5498b8f74a Remove extra exception handling.
Stop listener first, before we wait for open channels to close.
2016-07-24 09:48:54 +02:00
drieseng 44c21ca7af Merge branch 'develop' of https://github.com/sshnet/SSH.NET.git 2016-07-24 09:37:48 +02:00
drieseng 8c5b0e1921 Harden test. 2016-07-24 09:37:40 +02:00
Gert Driesen a1e20146c6 Added ForwardedPortStatus to VS 2012 projects. 2016-07-23 22:21:08 +02:00
drieseng 5048498bb1 Removed some debug code. 2016-07-23 19:33:00 +02:00
drieseng e1a557861c Correctly define the FEATURE_SOCKET_SETSOCKETOPTION symbol.
Use Socket.NoDelay property instead of the NoDelay option.
No longer use the DontLinger option as this is the default anyway.
2016-07-23 19:27:02 +02:00
drieseng 23bb333496 Remove unused import. 2016-07-23 19:11:17 +02:00
drieseng 6c6c762caa Use as instead of is and cast. 2016-07-23 19:09:31 +02:00
drieseng 59923ceca0 Added tests and some slashdocs for ForwardedPortStatus. 2016-07-23 17:58:42 +02:00