summaryrefslogtreecommitdiff
path: root/src/websockets/qwebsocketdataprocessor.cpp
diff options
context:
space:
mode:
authorRyan Chu <ryan.chu@qt.io>2019-06-30 13:56:25 +0200
committerRyan Chu <ryan.chu@qt.io>2019-08-23 15:28:40 +0200
commit24894c032719157a2d738f03e0c70d3ff0cf1782 (patch)
treee4b34ff85b5f5007093347f4019774e2ac82b78c /src/websockets/qwebsocketdataprocessor.cpp
parent140246105d3581ceb238134a02261d49417296c7 (diff)
downloadqtwebsockets-24894c032719157a2d738f03e0c70d3ff0cf1782.tar.gz
Make QWebSocketFrame::readFrame as a non-static public function
The static function QWebSocketFrame::readFrame used to return a parsed QWebSocketFrame read from QIODevice. This change make QWebSocketFrame reusable. It will base on its internal state and keep processing the incoming data from QIODevice. Change-Id: Ic6dea59529fa935cdb8034519e633ea67e869674 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/websockets/qwebsocketdataprocessor.cpp')
-rw-r--r--src/websockets/qwebsocketdataprocessor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/websockets/qwebsocketdataprocessor.cpp b/src/websockets/qwebsocketdataprocessor.cpp
index 4f81222..ee28969 100644
--- a/src/websockets/qwebsocketdataprocessor.cpp
+++ b/src/websockets/qwebsocketdataprocessor.cpp
@@ -125,7 +125,7 @@ void QWebSocketDataProcessor::process(QIODevice *pIoDevice)
bool isDone = false;
while (!isDone) {
- QWebSocketFrame frame = QWebSocketFrame::readFrame(pIoDevice);
+ frame.readFrame(pIoDevice);
if (Q_LIKELY(frame.isValid())) {
if (frame.isControlFrame()) {
isDone = processControlFrame(frame);
@@ -199,6 +199,7 @@ void QWebSocketDataProcessor::process(QIODevice *pIoDevice)
clear();
isDone = true;
}
+ frame.clear();
}
}