Fix for issue #84
This commit is contained in:
parent
f60f16f70f
commit
72867a26da
@ -131,7 +131,9 @@ namespace WebSocketSharp
|
||||
|
||||
private static byte[] readBytes (this Stream stream, byte[] buffer, int offset, int length)
|
||||
{
|
||||
var len = stream.Read (buffer, offset, length);
|
||||
var len = 0;
|
||||
try {
|
||||
len = stream.Read (buffer, offset, length);
|
||||
if (len < 1)
|
||||
return buffer.SubArray (0, offset);
|
||||
|
||||
@ -142,6 +144,9 @@ namespace WebSocketSharp
|
||||
|
||||
len += readLen;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
}
|
||||
|
||||
return len < length
|
||||
? buffer.SubArray (0, offset + len)
|
||||
@ -681,12 +686,8 @@ namespace WebSocketSharp
|
||||
? stream.readBytes (buff, len, length - len)
|
||||
: buff;
|
||||
}
|
||||
catch (ObjectDisposedException) {
|
||||
// The Stream has been closed.
|
||||
return;
|
||||
}
|
||||
catch {
|
||||
throw;
|
||||
bytes = new byte[0];
|
||||
}
|
||||
|
||||
if (completed != null)
|
||||
|
Loading…
Reference in New Issue
Block a user