From 29259d93691f0fc7790108c00a8718c07fa3ae5e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 10 Sep 2009 17:48:17 +0200 Subject: QLocalSocket::readData (Windows) must return -1 on EOF If we've detected a broken pipe and we have no more data in the read buffer, then we return -1 to signal EOF. Additionally, we close the QLocalSocket. Reviewed-by: ossi --- src/network/socket/qlocalsocket_win.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 93e0958..d6e70be 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -200,7 +200,10 @@ qint64 QLocalSocket::readData(char *data, qint64 maxSize) } if (d->pipeClosed) { - QTimer::singleShot(0, this, SLOT(_q_pipeClosed())); + if (readSoFar == 0) { + QTimer::singleShot(0, this, SLOT(_q_pipeClosed())); + return -1; // signal EOF + } } else { if (!d->readSequenceStarted) d->startAsyncRead(); -- cgit v0.12