summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2010-06-14 17:16:13 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2010-06-14 17:16:13 (GMT)
commit1d307402d03dea32b6e95a1eec6a79448fbe892a (patch)
tree368d6e3b5a6244f7c68320ff24a0f4d57b329b11 /src/network/socket
parentfd96a8180a5ccfeaea5b081c42137d18d640c25e (diff)
downloadQt-1d307402d03dea32b6e95a1eec6a79448fbe892a.zip
Qt-1d307402d03dea32b6e95a1eec6a79448fbe892a.tar.gz
Qt-1d307402d03dea32b6e95a1eec6a79448fbe892a.tar.bz2
QLocalSocket/Win: check for broken pipe in waitForReadyRead
In waitForReadyRead we didn't check for synchronous connection loss. Autotest added: tst_QLocalSocket::syncDisconnectNotify Reviewed-by: ossi
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qlocalsocket_win.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 01cbd4b..5486f47 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -570,11 +570,22 @@ bool QLocalSocket::waitForReadyRead(int msecs)
if (d->state != QLocalSocket::ConnectedState)
return false;
+ // We already know that the pipe is gone, but did not enter the event loop yet.
+ if (d->pipeClosed) {
+ close();
+ return false;
+ }
+
Q_ASSERT(d->readSequenceStarted);
DWORD result = WaitForSingleObject(d->overlapped.hEvent, msecs == -1 ? INFINITE : msecs);
switch (result) {
case WAIT_OBJECT_0:
d->_q_notified();
+ // We just noticed that the pipe is gone.
+ if (d->pipeClosed) {
+ close();
+ return false;
+ }
return true;
case WAIT_TIMEOUT:
return false;