From: Thorbjørn Lindeijer Date: Wed, 6 Apr 2011 14:31:09 +0000 (+0200) Subject: QDeclarativeDebugServer: Send hello answer before any service messages X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=84a5bde0c4aba8bab1556ccf221aab626bf68d3d;p=konrad%2Fqtdeclarative.git QDeclarativeDebugServer: Send hello answer before any service messages This is necessary since some services may like to send a message back immediately when its state changes to enabled. Reviewed-by: Kai Koehne (cherry picked from commit 9fa0a9319ee0f178d03f9bdc4afbabb8563b4c62) --- diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index 6f46354..d512809 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -250,6 +250,17 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) int version; in >> version >> d->clientPlugins; + // Send the hello answer immediately, since it needs to arrive before + // the plugins below start sending messages. + QByteArray helloAnswer; + { + QDataStream out(&helloAnswer, QIODevice::WriteOnly); + out << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); + } + d->connection->send(helloAnswer); + + d->gotHello = true; + QHash::Iterator iter = d->plugins.begin(); for (; iter != d->plugins.end(); ++iter) { QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; @@ -259,14 +270,6 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) iter.value()->statusChanged(newStatus); } - QByteArray helloAnswer; - { - QDataStream out(&helloAnswer, QIODevice::WriteOnly); - out << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); - } - d->connection->send(helloAnswer); - - d->gotHello = true; qWarning("QDeclarativeDebugServer: Connection established"); } else {