Browse Source

Sync APM and TAP implementation.

drieseng 9 năm trước cách đây
mục cha
commit
6836cff7b8
1 tập tin đã thay đổi với 7 bổ sung11 xóa
  1. 7 11
      src/Renci.SshNet/Shell.cs

+ 7 - 11
src/Renci.SshNet/Shell.cs

@@ -140,19 +140,15 @@ namespace Renci.SshNet
                             continue;
                         }
 #elif FEATURE_STREAM_APM
-                        var asyncResult = _input.BeginRead(buffer, 0, buffer.Length, delegate(IAsyncResult result)
-                        {
-                            //  If input stream is closed and disposed already dont finish reading the stream
-                            if (_input == null)
-                                return;
-
-                            var read = _input.EndRead(result);
-                            if (read > 0)
+                        var asyncResult = _input.BeginRead(buffer, 0, buffer.Length, result =>
                             {
-                                _channel.SendData(buffer, 0, read);
-                            }
+                                //  If input stream is closed and disposed already don't finish reading the stream
+                                if (_input == null)
+                                    return;
 
-                        }, null);
+                                var read = _input.EndRead(result);
+                                _channel.SendData(buffer, 0, read);
+                            }, null);
 
                         WaitHandle.WaitAny(new[] { asyncResult.AsyncWaitHandle, _channelClosedWaitHandle });