Fix for issue #84
This commit is contained in:
parent
36b860b75f
commit
2a3a62ec82
@ -671,14 +671,28 @@ namespace WebSocketSharp
|
|||||||
0,
|
0,
|
||||||
length,
|
length,
|
||||||
ar => {
|
ar => {
|
||||||
|
byte[] bytes = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var len = stream.EndRead (ar);
|
var len = stream.EndRead (ar);
|
||||||
var bytes = len < 1
|
bytes = len < 1
|
||||||
? new byte[0]
|
? new byte[0]
|
||||||
: len < length
|
: len < length
|
||||||
? stream.readBytes (buff, len, length - len)
|
? stream.readBytes (buff, len, length - len)
|
||||||
: buff;
|
: buff;
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException) {
|
||||||
|
// The Stream has been closed.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
if (error != null)
|
||||||
|
error (ex);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (completed != null)
|
if (completed != null)
|
||||||
completed (bytes);
|
completed (bytes);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user