[Modify] Polish it

This commit is contained in:
sta 2021-02-02 21:25:20 +09:00
parent 0e633fa6e9
commit f698486de3

View File

@ -246,15 +246,16 @@ namespace WebSocketSharp.Net
if (_disposed)
throw new ObjectDisposedException (GetType ().ToString ());
// Call the fillFromBuffer method to check for buffer boundaries even when _bodyLeft is 0.
var nread = fillFromBuffer (buffer, offset, count);
if (nread == -1) // No more bytes available (Content-Length).
if (nread == -1)
return 0;
if (nread > 0)
return nread;
nread = _stream.Read (buffer, offset, count);
if (nread > 0 && _bodyLeft > 0)
_bodyLeft -= nread;