diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-06-20 11:52:18 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2011-06-20 12:55:44 +0200 |
commit | fab51c4220b84d15d517e698da59cfb05da02729 (patch) | |
tree | 5b9cd2790ea3012e52a658e6a97f14ed5bfea489 /src/declarative/debugger | |
parent | f4cd86c5a147c91f8ab671627b96606b373bcc2d (diff) |
QDeclarativeDebug: Fix cases where multiple packets arrive in one go
Make sure no packets get 'lost' when they're arriving in one go through
the TCP/IP socket.
Reviewed-by: Christiaan Janssen
Diffstat (limited to 'src/declarative/debugger')
-rw-r--r-- | src/declarative/debugger/qpacketprotocol.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 9caaa79011..f53d2a38a2 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -164,12 +164,16 @@ public Q_SLOTS: void readyToRead() { + bool gotPackets = false; while (true) { - // Need to get trailing data + // Get size header (if not in progress) if (-1 == inProgressSize) { // We need a size header of sizeof(qint32) - if (sizeof(qint32) > (uint)dev->bytesAvailable()) - return; + if (sizeof(qint32) > (uint)dev->bytesAvailable()) { + if (gotPackets) + emit readyRead(); + return; // no more data available + } // Read size header int read = dev->read((char *)&inProgressSize, sizeof(qint32)); @@ -200,9 +204,12 @@ public Q_SLOTS: inProgress.clear(); waitingForPacket = false; - emit readyRead(); - } else - return; + gotPackets = true; + } else { + if (gotPackets) + emit readyRead(); + return; // packet in progress is not yet complete + } } } } |