diff options
author | Andreas Kling <andreas.kling@nokia.com> | 2010-01-20 08:34:08 (GMT) |
---|---|---|
committer | Andreas Kling <andreas.kling@nokia.com> | 2010-01-20 08:34:08 (GMT) |
commit | 01f733a64e45363e74bea62e4cae8a658bc09383 (patch) | |
tree | ea39b38552a063e7e10bd432b1155a7abae61620 /src/network/socket/qnativesocketengine_win.cpp | |
parent | fdf463ba74b2e00ba5f9db10f43585e8b15054f7 (diff) | |
parent | b906feddf1593a837785bc41d65e837e64d31284 (diff) | |
download | Qt-01f733a64e45363e74bea62e4cae8a658bc09383.zip Qt-01f733a64e45363e74bea62e4cae8a658bc09383.tar.gz Qt-01f733a64e45363e74bea62e4cae8a658bc09383.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'src/network/socket/qnativesocketengine_win.cpp')
-rw-r--r-- | src/network/socket/qnativesocketengine_win.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 81bffd9..8257545 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -994,9 +994,9 @@ 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 + qint64 bytesToSend = len; + for (;;) { - qint64 bytesToSend = qMin<qint64>(49152, len - ret); WSABUF buf; buf.buf = (char*)data + ret; buf.len = bytesToSend; @@ -1014,6 +1014,12 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) continue; } else if (WSAGetLastError() == WSAEWOULDBLOCK) { break; + } else if (WSAGetLastError() == WSAENOBUFS) { + // this function used to not send more than 49152 per call to WSASendTo + // to avoid getting a WSAENOBUFS. However this is a performance regression + // and we think it only appears with old windows versions. We now handle the + // WSAENOBUFS and hope it never appears anyway. + // just go on, the next loop run we will try a smaller number } else { int err = WSAGetLastError(); WS_ERROR_DEBUG(err); @@ -1029,6 +1035,9 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) } break; } + + // for next send: + bytesToSend = qMin<qint64>(49152, len - ret); } #if defined (QNATIVESOCKETENGINE_DEBUG) |