From c4544a4d21a89502321af313eb2fab56271c7c5d Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 6 Mar 2013 21:03:26 +0100 Subject: [PATCH] Limit maximum attempted data writing to 50KiB per block (resolves slowness issues with small network buffers and/or big packets). --- lib/socket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/socket.cpp b/lib/socket.cpp index a9a7eec3..1c5a02f8 100644 --- a/lib/socket.cpp +++ b/lib/socket.cpp @@ -402,7 +402,7 @@ void Socket::Connection::SendNow(const char * data, size_t len){ } int i = iwrite(data, len); while (i < len && connected()){ - int j = iwrite(data + i, len - i); + int j = iwrite(data + i, std::min(len - i, (size_t)51200)); if (j > 0){ i += j; }else{