[Modify] Polish it

This commit is contained in:
sta 2018-02-24 19:31:27 +09:00
parent 187022a27a
commit 465949f4f0

View File

@ -740,7 +740,8 @@ namespace WebSocketSharp.Net
internal bool FlushInput () internal bool FlushInput ()
{ {
if (!HasEntityBody) var input = InputStream;
if (input == Stream.Null)
return true; return true;
var len = 2048; var len = 2048;
@ -751,14 +752,14 @@ namespace WebSocketSharp.Net
while (true) { while (true) {
try { try {
var ares = InputStream.BeginRead (buff, 0, len, null, null); var ares = input.BeginRead (buff, 0, len, null, null);
if (!ares.IsCompleted) { if (!ares.IsCompleted) {
var timeout = 100; var timeout = 100;
if (!ares.AsyncWaitHandle.WaitOne (timeout)) if (!ares.AsyncWaitHandle.WaitOne (timeout))
return false; return false;
} }
if (InputStream.EndRead (ares) <= 0) if (input.EndRead (ares) <= 0)
return true; return true;
} }
catch { catch {