Debugger: Warn if we receive corrupted packets
authorKai Koehne <kai.koehne@nokia.com>
Thu, 6 Oct 2011 14:37:48 +0000 (16:37 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 7 Oct 2011 08:52:41 +0000 (10:52 +0200)
Change-Id: Ie99e6806203d5c36dc8d3eb7778a04562c4d6871
Reviewed-on: http://codereview.qt-project.org/6170
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>

src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp
src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h

index 512ea65..f9bf9dd 100644 (file)
@@ -180,12 +180,18 @@ void QTcpServerConnection::newConnection()
     d->socket->setParent(this);
     d->protocol = new QPacketProtocol(d->socket, this);
     QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+    QObject::connect(d->protocol, SIGNAL(invalidPacket()), this, SLOT(invalidPacket()));
 
     if (d->block) {
         d->protocol->waitForReadyRead(-1);
     }
 }
 
+void QTcpServerConnection::invalidPacket()
+{
+    qWarning("QDeclarativeDebugServer: Received a corrupted packet! Giving up ...");
+}
+
 Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection)
 
 QT_END_NAMESPACE
index f688671..315f55a 100644 (file)
@@ -75,6 +75,7 @@ public:
 private Q_SLOTS:
     void readyRead();
     void newConnection();
+    void invalidPacket();
 
 private:
     QTcpServerConnectionPrivate *d_ptr;