summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-01-19 17:06:33 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-01-20 11:38:09 (GMT)
commit5b1b8a893137e91a9bc88452602b677358a2ac71 (patch)
tree70f0a01654a1da77f86ca02cf990f0464389a524 /src
parentf41ae98f130fb94c5d1ec55fceb27a60014ac90c (diff)
downloadQt-5b1b8a893137e91a9bc88452602b677358a2ac71.zip
Qt-5b1b8a893137e91a9bc88452602b677358a2ac71.tar.gz
Qt-5b1b8a893137e91a9bc88452602b677358a2ac71.tar.bz2
Avoid calling WSAGetLastError() so often in nativeWrite
Reviewed-by: joao
Diffstat (limited to 'src')
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 8257545..7088a57 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -1007,21 +1007,21 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len)
ret += qint64(bytesWritten);
+ int err;
if (socketRet != SOCKET_ERROR) {
if (ret == len)
break;
else
continue;
- } else if (WSAGetLastError() == WSAEWOULDBLOCK) {
+ } else if ((err = WSAGetLastError()) == WSAEWOULDBLOCK) {
break;
- } else if (WSAGetLastError() == WSAENOBUFS) {
+ } else if (err == 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);
switch (err) {
case WSAECONNRESET: