From 5df964bf37405957e9fa4b359b6da72f2b9a1e46 Mon Sep 17 00:00:00 2001 From: Michael Ushakov Date: Tue, 4 Apr 2017 22:38:07 +0400 Subject: [PATCH] Some fixes --- .../TestUtils/NetworkClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TinyTcpServer/MossbauerLab.TinyTcpServer.Core.FunctionalTests/TestUtils/NetworkClient.cs b/TinyTcpServer/MossbauerLab.TinyTcpServer.Core.FunctionalTests/TestUtils/NetworkClient.cs index 6bb1c83..3a6d946 100644 --- a/TinyTcpServer/MossbauerLab.TinyTcpServer.Core.FunctionalTests/TestUtils/NetworkClient.cs +++ b/TinyTcpServer/MossbauerLab.TinyTcpServer.Core.FunctionalTests/TestUtils/NetworkClient.cs @@ -184,7 +184,7 @@ 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(); @@ -192,7 +192,7 @@ private Boolean ReadAsync(Byte[] data, out Int32 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--;