summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2010-06-17 11:38:27 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2010-06-17 12:18:27 (GMT)
commit4d0c4b9f09b35d707d437611519d0024f6f87a8c (patch)
treecb76c836a71c853bf6db486a63d58d2c30a74a97
parent600a19ab7cecc32a3b31c873900303005fb3d672 (diff)
downloadQt-4d0c4b9f09b35d707d437611519d0024f6f87a8c.zip
Qt-4d0c4b9f09b35d707d437611519d0024f6f87a8c.tar.gz
Qt-4d0c4b9f09b35d707d437611519d0024f6f87a8c.tar.bz2
QLocalSocket/Win: handle ERROR_MORE_DATA after read operation
If we're connected to a name pipe which is in message mode, we have to handle the following case: ReadFile() or GetOverlappedResult() return FALSE and GetLastError() returns ERROR_MORE_DATA. This just means, that the message didn't fit into the pipe's internal buffer. We must not handle this as error. Task-number: QTBUG-11490 Reviewed-by: ossi
-rw-r--r--src/network/socket/qlocalsocket_win.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 5486f47..4907f2c 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -280,6 +280,12 @@ void QLocalSocketPrivate::startAsyncRead()
case ERROR_IO_PENDING:
// This is not an error. We're getting notified, when data arrives.
return;
+ case ERROR_MORE_DATA:
+ // This is not an error. The synchronous read succeeded.
+ // We're connected to a message mode pipe and the message
+ // didn't fit into the pipe's system buffer.
+ completeAsyncRead();
+ break;
case ERROR_PIPE_NOT_CONNECTED:
{
// It may happen, that the other side closes the connection directly
@@ -309,9 +315,18 @@ bool QLocalSocketPrivate::completeAsyncRead()
DWORD bytesRead;
if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) {
- if (GetLastError() != ERROR_PIPE_NOT_CONNECTED)
+ switch (GetLastError()) {
+ case ERROR_MORE_DATA:
+ // This is not an error. We're connected to a message mode
+ // pipe and the message didn't fit into the pipe's system
+ // buffer. We will read the remaining data in the next call.
+ break;
+ case ERROR_PIPE_NOT_CONNECTED:
setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead"));
- return false;
+ // fall through
+ default:
+ return false;
+ }
}
actualReadBufferSize += bytesRead;