-
-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve shell stream #1514
base: develop
Are you sure you want to change the base?
Improve shell stream #1514
Conversation
* Added SendWindowChangeRequest to ShellStream * Added a new constructor to ShellStream When creating ShellStream, the channel will be immediately opened in the constructor of ShellStream. At this time, the calling module may not have subscribed to ShellStream's DataReceived event, which may result in the loss of a small piece of data immediately after connection. You can use ShellStream's new constructor to solve this problem
* Added SendWindowChangeRequest to ShellStream * Added a new constructor to ShellStream * SshClient adds an overload function for CreateShellStream When creating ShellStream, the channel will be immediately opened in the constructor of ShellStream. At this time, the calling module may not have subscribed to ShellStream's DataReceived event, which may result in the loss of a small piece of data immediately after connection. You can use ShellStream's new constructor to solve this problem
Why does AppVeyor fail? |
Hi @294797392 Are you able solve your problem using the byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = shellStream.Read(buffer) != 0)
{
// Process "bytesRead" bytes from buffer
} |
Yes, using the Read function can solve my problem. |
Yes it seems reasonable to add SendWindowChangeRequest - there have been previous requests for it. Personally I would suggest to:
Let me know what you think |
I agree with your idea. |
Ok, bool seems fine to me - I don't feel strongly about it |
Do you agree with me changing it to a boolean return value? If you agree, I will submit another PR |
Yes |
…dWindowChangeRequest 2. Added SendWindowChangeRequest_ThrowsObjectDisposedException to ShellStreamTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change ChannelSession.SendWindowChangeRequest
to call TrySendMessage
instead of SendMessage
?
@@ -123,6 +123,18 @@ public void Write_AfterDispose_ThrowsObjectDisposedException() | |||
Assert.ThrowsException<ObjectDisposedException>(() => shellStream.Write(bytes, 0, bytes.Length)); | |||
} | |||
|
|||
[TestMethod] | |||
public void SendWindowChangeRequest_ThrowsObjectDisposedException() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a simple test which verifies the call to ChannelSession.SendWindowChangeRequest
?
Improve ShellStream
Added SendWindowChangeRequest to ShellStream
Added a new constructor to ShellStream
SshClient adds an overload function for CreateShellStream
When creating ShellStream, the channel will be immediately opened in the constructor of ShellStream. At this time, the calling module may not have subscribed to ShellStream's DataReceived event, which may result in the loss of a small piece of data immediately after connection.
You can use ShellStream's new constructor to solve this problem