[Modify] Polish it

This commit is contained in:
sta 2021-01-03 22:08:56 +09:00
parent b75699010a
commit c403715c1d

View File

@ -764,10 +764,12 @@ namespace WebSocketSharp.Net
internal bool FlushInput () internal bool FlushInput ()
{ {
var input = InputStream; var input = InputStream;
if (input == Stream.Null) if (input == Stream.Null)
return true; return true;
var len = 2048; var len = 2048;
if (_contentLength > 0 && _contentLength < len) if (_contentLength > 0 && _contentLength < len)
len = (int) _contentLength; len = (int) _contentLength;
@ -776,8 +778,10 @@ namespace WebSocketSharp.Net
while (true) { while (true) {
try { try {
var ares = input.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;
} }