Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilLord666 committed Apr 4, 2017
1 parent d98dec0 commit 5df964b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ private Boolean ReadAsync(Byte[] data, out Int32 bytesRead)
{
Console.WriteLine("[CLIENT, ReadAsync] client {0} , read started", _id);
_bytesRead = 0;
const Int32 readAttempts = 6;
const Int32 readAttempts = 16;
for (Int32 attempt = 0; attempt < readAttempts; attempt++)
{
_readCompleted.Reset();
Int32 offset = _bytesRead;
Int32 size = _clientSocket.Available;
_clientSocket.BeginReceive(data, offset, size, SocketFlags.Partial, ReadAsyncCallback, _clientSocket);
_readCompleted.Wait(_readTimeout);
if (_bytesRead == data.Length || (_bytesRead > 0 && data.Length < _clientSocket.ReceiveBufferSize))
if (_bytesRead == data.Length || (_bytesRead > 0 && data.Length < 3 * _clientSocket.ReceiveBufferSize / 4))
break;
if (attempt > 0 && _bytesRead > offset)
attempt--;
Expand Down

0 comments on commit 5df964b

Please sign in to comment.