in CancelAsync, we were sending exit-signal channel request, when in fact we should be sending signal and the server will respond with exit-signal. This explains why we did not see any response or channel close in #1345 (@zeotuan fyi). Add a corresponding string? ExitSignal property which has a value when the server sends one. (closes #95 - seems like it existed once upon a time).
Previously, we were setting the IAsyncResult.WaitHandle only when the command had completed successfully, or otherwise once EndExecute had been called. But we should be setting it as soon as the command completes whether successfully, with an error or via cancellation. This refactors the logic by removing the extra wait handles and consolidating the completion logic onto the IAsyncResult.WaitHandle. With this refactoring the logic intentionally looks (with some squinting) similar to a Task. Adding ExecuteAsync should only be a small step from here.
Take a breaking change on ExitStatus by changing the return type from int to int?, in order to distinguish between an exit status of 0 and when no exit status has been returned (because for example, an exit signal was returned instead). This is the second commit.
CancelAsync
, we were sendingexit-signal
channel request, when in fact we should be sendingsignal
and the server will respond withexit-signal
. This explains why we did not see any response or channel close in #1345 (@zeotuan fyi). Add a correspondingstring? ExitSignal
property which has a value when the server sends one. (closes #95 - seems like it existed once upon a time).IAsyncResult.WaitHandle
only when the command had completed successfully, or otherwise onceEndExecute
had been called. But we should be setting it as soon as the command completes whether successfully, with an error or via cancellation. This refactors the logic by removing the extra wait handles and consolidating the completion logic onto theIAsyncResult.WaitHandle
. With this refactoring the logic intentionally looks (with some squinting) similar to aTask
. AddingExecuteAsync
should only be a small step from here.ExitStatus
by changing the return type fromint
toint?
, in order to distinguish between an exit status of 0 and when no exit status has been returned (because for example, an exit signal was returned instead). This is the second commit.