diff options
Diffstat (limited to 'src/websockets/qsslserver.cpp')
-rw-r--r-- | src/websockets/qsslserver.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/websockets/qsslserver.cpp b/src/websockets/qsslserver.cpp index 586e520..ec645c9 100644 --- a/src/websockets/qsslserver.cpp +++ b/src/websockets/qsslserver.cpp @@ -118,11 +118,11 @@ void QSslServer::incomingConnection(qintptr socket) connect(pSslSocket, QOverload<const QList<QSslError>&>::of(&QSslSocket::sslErrors), this, &QSslServer::sslErrors); connect(pSslSocket, &QSslSocket::encrypted, - this, &QSslServer::newEncryptedConnection); + this, &QSslServer::socketEncrypted); connect(pSslSocket, &QSslSocket::preSharedKeyAuthenticationRequired, this, &QSslServer::preSharedKeyAuthenticationRequired); - addPendingConnection(pSslSocket); + Q_EMIT startedEncryptionHandshake(pSslSocket); pSslSocket->startServerEncryption(); } else { @@ -131,4 +131,15 @@ void QSslServer::incomingConnection(qintptr socket) } } +void QSslServer::socketEncrypted() +{ + QSslSocket *pSslSocket = qobject_cast<QSslSocket *>(sender()); + + // We do not add the connection until the encryption handshake is complete. + // In case the handshake is aborted, we would be left with a stale + // connection in the queue otherwise. + addPendingConnection(pSslSocket); + Q_EMIT newEncryptedConnection(); +} + QT_END_NAMESPACE |