QNativeSocketEngine/Win: fix write() in case of splitting

When a first call to ::WSASend() consumes less data than requested, we
are trying to make a second call, leaving 'bytesToSend' unmodified.

Instead of setting a new value for 'bytesToSend', it seems reasonable
to break the loop, if the system buffer overflow detected.

Pick-to: 5.15
Change-Id: I8038e95c20221518955efe786f2d0dadb98360fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Alex Trotsenko 2020-07-27 19:21:37 +03:00
parent 30395e9185
commit 83f00b8229

View File

@ -1444,10 +1444,8 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len)
int err;
if (socketRet != SOCKET_ERROR) {
if (ret == len)
if (ret == len || bytesToSend != qint64(bytesWritten))
break;
else
continue;
} else if ((err = WSAGetLastError()) == WSAEWOULDBLOCK) {
break;
} else if (err == WSAENOBUFS) {