Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/Renci.SshNet/Common/PipeStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ public override void SetLength(long value)
///<exception cref="ArgumentOutOfRangeException">offset or count is negative.</exception>
public override int Read(byte[] buffer, int offset, int count)
{
if (offset != 0)
throw new NotSupportedException("Offsets with value of non-zero are not supported");
if (buffer == null)
throw new ArgumentNullException("buffer");
if (offset + count > buffer.Length)
Expand Down Expand Up @@ -213,7 +211,7 @@ public override int Read(byte[] buffer, int offset, int count)
// fill the read buffer
for (; readLength < count && _buffer.Count > 0; readLength++)
{
buffer[readLength] = _buffer.Dequeue();
buffer[readLength + offset] = _buffer.Dequeue();
}

Monitor.Pulse(_buffer);
Expand All @@ -230,7 +228,7 @@ public override int Read(byte[] buffer, int offset, int count)
private bool ReadAvailable(int count)
{
var length = Length;
return (_isFlushed || length >= count) && (length >= (count + 1) || !BlockLastReadBuffer);
return (_isFlushed || length > 0) && (length >= (count + 1) || !BlockLastReadBuffer);
}

///<summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet/Shell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void Start()
}
finally
{
_dataReaderTaskCompleted.Set();
_dataReaderTaskCompleted?.Set();
}
});

Expand Down