Use queued connection for readyRead connection
authorKurt Pattyn <pattyn.kurt@gmail.com>
Thu, 13 Feb 2014 21:38:02 +0000 (22:38 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 13 Feb 2014 23:45:30 +0000 (00:45 +0100)
Task-number: QTBUG-36757
Change-Id: I4358563d52ecbff7b7e1575c5d34cef30b5fcd52
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
src/websockets/qwebsocketserver_p.cpp

index f1c616d..a5f9169 100644 (file)
@@ -377,8 +377,12 @@ void QWebSocketServerPrivate::setError(QWebSocketProtocol::CloseCode code, const
 void QWebSocketServerPrivate::onNewConnection()
 {
     QTcpSocket *pTcpSocket = m_pTcpServer->nextPendingConnection();
+    //use a queued connection because a QSslSocket
+    //needs the event loop to process incoming data
+    //if not queued, data is incomplete when handshakeReceived is called
     QObjectPrivate::connect(pTcpSocket, &QTcpSocket::readyRead,
-                            this, &QWebSocketServerPrivate::handshakeReceived);
+                            this, &QWebSocketServerPrivate::handshakeReceived,
+                            Qt::QueuedConnection);
 }
 
 /*!