Fix PipeStream.Read returning 0 prematurely #924
Fix PipeStream.Read returning 0 prematurely #924IgorMilavec wants to merge 4 commits intosshnet:developfrom
Conversation
|
@IgorMilavec I definitely want this change in, but there are still a few things to consider:
|
|
public static int ReadBlock(this Stream stream, byte[] buffer, int offset, int count)
{
#region Validate arguments
if (stream is null)
{
throw new ArgumentNullException(nameof(stream));
}
#endregion
int bufferLength = 0;
while (bufferLength < count)
{
int readLength = stream.Read(buffer, offset + bufferLength, count - bufferLength);
if (readLength == 0)
{
break;
}
bufferLength += readLength;
}
return bufferLength;
}Works for every stream, I also have an async version... But generally, |
|
Just found out that I checked the integration tests and |
Fixes PipeStream.Read to block until more data is received or the session is closed.
This will fix #12, fix #164, fix #440, fix #650