aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_server
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-02-06 17:47:39 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-04-05 06:54:28 +0000
commitfeeec8daa8412219dadddfb6e7cfa17f59451a32 (patch)
tree0f7e970273a10fb00cb3b0ef1c2642d188a07272 /src/plugins/qmltooling/qmldbg_server
parentfd8c3e41fc90bb431159343926dff628a860f289 (diff)
QPacketProtocol: Add proper error handling
The device is not guaranteed to write or read all the data we ask for in one go. Retry and check for read or write errors. Change-Id: I640bdaf4d9eb7b900c8f7145bd42eb5d667a9cad Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_server')
-rw-r--r--src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
index 0a468c0b84..27b310a0ae 100644
--- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
+++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
@@ -176,7 +176,7 @@ private:
void changeServiceState(const QString &serviceName, QQmlDebugService::State state);
void removeThread();
void receiveMessage();
- void invalidPacket();
+ void protocolError();
QQmlDebugServerConnection *m_connection;
QHash<QString, QQmlDebugService *> m_plugins;
@@ -521,7 +521,7 @@ void QQmlDebugServerImpl::receiveMessage()
} else {
qWarning("QML Debugger: Invalid control message %d.", op);
- invalidPacket();
+ protocolError();
return;
}
@@ -736,16 +736,16 @@ void QQmlDebugServerImpl::setDevice(QIODevice *socket)
m_protocol = new QPacketProtocol(socket, this);
QObject::connect(m_protocol, &QPacketProtocol::readyRead,
this, &QQmlDebugServerImpl::receiveMessage);
- QObject::connect(m_protocol, &QPacketProtocol::invalidPacket,
- this, &QQmlDebugServerImpl::invalidPacket);
+ QObject::connect(m_protocol, &QPacketProtocol::error,
+ this, &QQmlDebugServerImpl::protocolError);
if (blockingMode())
m_protocol->waitForReadyRead(-1);
}
-void QQmlDebugServerImpl::invalidPacket()
+void QQmlDebugServerImpl::protocolError()
{
- qWarning("QML Debugger: Received a corrupted packet! Giving up ...");
+ qWarning("QML Debugger: A protocol error has occurred! Giving up ...");
m_connection->disconnect();
// protocol might still be processing packages at this point
m_protocol->deleteLater();