All pastes #961096 Raw Edit

Untitled

public diff v1 · immutable
#961096 ·published 2008-03-28 17:49 UTC
rendered paste body
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cppindex b1da704..d228e04 100644--- a/src/network/socket/qnativesocketengine_win.cpp+++ b/src/network/socket/qnativesocketengine_win.cpp@@ -1001,9 +1001,14 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) {     Q_Q(QNativeSocketEngine);     qint64 ret = 0;-    // don't send more than 49152 per call to WSASendTo to avoid getting a WSAENOBUFS+    // don't send more than the buffer size per call to WSASend to avoid getting a WSAENOBUFS+    int sndbuf;+    int optlen = sizeof sndbuf;+    if (getsockopt(socketDescriptor, SOL_SOCKET, SO_SNDBUF, (char*)&sndbuf, &optlen) == SOCKET_ERROR)+        sndbuf = 49152;         // the default value+     for (;;) {-        qint64 bytesToSend = qMin<qint64>(49152, len - ret);+        qint64 bytesToSend = qMin<qint64>(sndbuf - 1, len - ret);         WSABUF buf;         buf.buf = (char*)data + ret;         buf.len = bytesToSend;@@ -1018,7 +1023,7 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len)             if (ret == len)                 break;             else-                continue;+                break;         } else if (WSAGetLastError() == WSAEWOULDBLOCK) {             break;         } else {