summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-05-22 14:07:34 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-05-29 08:50:46 +0000
commit5edfb3c7ee338c0b562f33a8c4315454bfc18886 (patch)
tree1dfe86afa8b188448b44dd1e53447aa54d7962a8 /src
parent79e84ac39d17264d24c732a4e9693f4b5b57b3ac (diff)
downloadqtwebsockets-5edfb3c7ee338c0b562f33a8c4315454bfc18886.tar.gz
QWebSocketServer: handle new connection after invalid one
Manually tested with sslechoserver and sslechoclient in examples, invalid connection from "telnet localhost 1234". Task-number: QTBUG-44866 Change-Id: I19c29c7c5f57eef4f9ae069e105fd1db346fb5c5 Reviewed-by: Luca Niccoli <lultimouomo@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/websockets/qwebsocketserver_p.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/websockets/qwebsocketserver_p.cpp b/src/websockets/qwebsocketserver_p.cpp
index 73ca9d7..bc23674 100644
--- a/src/websockets/qwebsocketserver_p.cpp
+++ b/src/websockets/qwebsocketserver_p.cpp
@@ -370,13 +370,15 @@ 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,
- Qt::QueuedConnection);
+ while (m_pTcpServer->hasPendingConnections()) {
+ 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,
+ Qt::QueuedConnection);
+ }
}
/*!