From e10eca486f463f612516884a92d09bb50c33f988 Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Tue, 27 Aug 2013 23:03:18 +0200 Subject: [PATCH] Redirect errors to DISPATCH_RESULT state, instead of directly setting isDone=true (makes the code cleaner, but a bit slower on errors) --- src/dataprocessor_p.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/dataprocessor_p.cpp b/src/dataprocessor_p.cpp index 905f81f..71934e5 100644 --- a/src/dataprocessor_p.cpp +++ b/src/dataprocessor_p.cpp @@ -304,7 +304,7 @@ Frame Frame::readFrame(QIODevice *pIoDevice) if (!ok) { frame.setError(QWebSocketProtocol::CC_GOING_AWAY, QObject::tr("Timeout when reading data from socket.")); - isDone = true; + processingState = PS_DISPATCH_RESULT; } else { @@ -350,7 +350,7 @@ Frame Frame::readFrame(QIODevice *pIoDevice) } if (!frame.checkValidity()) { - isDone = true; + processingState = PS_DISPATCH_RESULT; } } else @@ -379,8 +379,8 @@ Frame Frame::readFrame(QIODevice *pIoDevice) } else { - processingState = hasMask ? PS_READ_MASK : PS_READ_PAYLOAD; - } + processingState = hasMask ? PS_READ_MASK : PS_READ_PAYLOAD; + } } else { @@ -402,9 +402,9 @@ Frame Frame::readFrame(QIODevice *pIoDevice) } else { - //Most significant bit must be set to 0 as per http://tools.ietf.org/html/rfc6455#section-5.2 + //Most significant bit must be set to 0 as per http://tools.ietf.org/html/rfc6455#section-5.2 //TODO: Do we check for that? Now we just strip off the highest bit - payloadLength = qFromBigEndian(length) & ~(1ULL << 63); + payloadLength = qFromBigEndian(length) & ~(1ULL << 63); if (payloadLength < 0xFFFFu) { //see http://tools.ietf.org/html/rfc6455#page-28 paragraph 5.2 @@ -416,8 +416,8 @@ Frame Frame::readFrame(QIODevice *pIoDevice) } else { - processingState = hasMask ? PS_READ_MASK : PS_READ_PAYLOAD; - } + processingState = hasMask ? PS_READ_MASK : PS_READ_PAYLOAD; + } } } else @@ -468,12 +468,12 @@ Frame Frame::readFrame(QIODevice *pIoDevice) } else { - if (hasMask) - { - QWebSocketProtocol::mask(&frame.m_payload, frame.m_mask); + if (hasMask) + { + QWebSocketProtocol::mask(&frame.m_payload, frame.m_mask); + } + processingState = PS_DISPATCH_RESULT; } - processingState = PS_DISPATCH_RESULT; - } } else { -- 2.7.4