diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2021-07-22 16:55:47 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2021-07-24 16:55:43 +0300 |
commit | 6481733d45805ecbe22a0806923ee2e0894ecc28 (patch) | |
tree | ca88956618c45ab3ba43c3005cdbd22e9b888671 /src/network/socket | |
parent | 594948a07b8086c96ba720e92473c6175d4ac918 (diff) |
QLocalSocket/Win: do not flush the pipe in disconnectFromServer()
In the case where we have pending data to write, calling flush() here
may cause the device to close immediately, if the pipe writer already
got a result of the last operation from the thread pool. In this
scenario, the device does not enter the 'Closing' state, which leads
the following code to unexpectedly fail on Windows
socket.write(...);
socket.disconnectFromServer();
QVERIFY(socket.waitForDisconnected());
Removing the call to flush() makes the behavior consistent with the
implementation on Unix.
Change-Id: Ic31fbc999be979c1e5befa8f132d9fb367f472ca
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/network/socket')
-rw-r--r-- | src/network/socket/qlocalsocket_win.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index bd299d6cf5..df319d2c1e 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -403,7 +403,6 @@ void QLocalSocket::disconnectFromServer() { Q_D(QLocalSocket); - flush(); if (bytesToWrite() != 0) { d->state = QLocalSocket::ClosingState; emit stateChanged(d->state); |