Skip to content

Commit 6836cff

Browse files
committed
Sync APM and TAP implementation.
1 parent 0d569fb commit 6836cff

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/Renci.SshNet/Shell.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,15 @@ public void Start()
140140
continue;
141141
}
142142
#elif FEATURE_STREAM_APM
143-
var asyncResult = _input.BeginRead(buffer, 0, buffer.Length, delegate(IAsyncResult result)
144-
{
145-
// If input stream is closed and disposed already dont finish reading the stream
146-
if (_input == null)
147-
return;
148-
149-
var read = _input.EndRead(result);
150-
if (read > 0)
143+
var asyncResult = _input.BeginRead(buffer, 0, buffer.Length, result =>
151144
{
152-
_channel.SendData(buffer, 0, read);
153-
}
145+
// If input stream is closed and disposed already don't finish reading the stream
146+
if (_input == null)
147+
return;
154148

155-
}, null);
149+
var read = _input.EndRead(result);
150+
_channel.SendData(buffer, 0, read);
151+
}, null);
156152

157153
WaitHandle.WaitAny(new[] { asyncResult.AsyncWaitHandle, _channelClosedWaitHandle });
158154

0 commit comments

Comments
 (0)