diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2022-08-16 13:33:15 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2022-08-17 21:55:18 +0200 |
commit | fb4123f36a88f6e890ed2e7f9b462665bfdcd6c0 (patch) | |
tree | 0f37113c2f27af70963cd16247b4076002898cc5 /src | |
parent | 9e3e167223d2d16b4b0dac0be72ce212e47665b4 (diff) |
QSslServer: pass 'this' as a context to connections to socket
Then we don't have to do a 'global' disconnect() on the socket object
just to disconnect the QSslServer from the socket.
Pick-to: 6.4
Change-Id: Ie3c9680db2717e21a0c548c74374a58d533534fe
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/ssl/qsslserver.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/network/ssl/qsslserver.cpp b/src/network/ssl/qsslserver.cpp index 727d647784..a26e79e315 100644 --- a/src/network/ssl/qsslserver.cpp +++ b/src/network/ssl/qsslserver.cpp @@ -241,39 +241,39 @@ void QSslServer::incomingConnection(qintptr socket) pSslSocket->setSslConfiguration(sslConfiguration()); if (Q_LIKELY(pSslSocket->setSocketDescriptor(socket))) { - connect(pSslSocket, &QSslSocket::peerVerifyError, + connect(pSslSocket, &QSslSocket::peerVerifyError, this, [this, pSslSocket](const QSslError &error) { Q_EMIT peerVerifyError(pSslSocket, error); }); - connect(pSslSocket, &QSslSocket::sslErrors, + connect(pSslSocket, &QSslSocket::sslErrors, this, [this, pSslSocket](const QList<QSslError> &errors) { Q_EMIT sslErrors(pSslSocket, errors); }); - connect(pSslSocket, &QAbstractSocket::errorOccurred, + connect(pSslSocket, &QAbstractSocket::errorOccurred, this, [this, pSslSocket](QAbstractSocket::SocketError error) { Q_EMIT errorOccurred(pSslSocket, error); if (!pSslSocket->isEncrypted()) pSslSocket->deleteLater(); }); - connect(pSslSocket, &QSslSocket::encrypted, [this, pSslSocket]() { - pSslSocket->disconnect(); + connect(pSslSocket, &QSslSocket::encrypted, this, [this, pSslSocket]() { + pSslSocket->disconnect(this); addPendingConnection(pSslSocket); }); - connect(pSslSocket, &QSslSocket::preSharedKeyAuthenticationRequired, + connect(pSslSocket, &QSslSocket::preSharedKeyAuthenticationRequired, this, [this, pSslSocket](QSslPreSharedKeyAuthenticator *authenticator) { Q_EMIT preSharedKeyAuthenticationRequired(pSslSocket, authenticator); }); - connect(pSslSocket, &QSslSocket::alertSent, + connect(pSslSocket, &QSslSocket::alertSent, this, [this, pSslSocket](QSsl::AlertLevel level, QSsl::AlertType type, const QString &description) { Q_EMIT alertSent(pSslSocket, level, type, description); }); - connect(pSslSocket, &QSslSocket::alertReceived, + connect(pSslSocket, &QSslSocket::alertReceived, this, [this, pSslSocket](QSsl::AlertLevel level, QSsl::AlertType type, const QString &description) { Q_EMIT alertReceived(pSslSocket, level, type, description); }); - connect(pSslSocket, &QSslSocket::handshakeInterruptedOnError, + connect(pSslSocket, &QSslSocket::handshakeInterruptedOnError, this, [this, pSslSocket](const QSslError &error) { Q_EMIT handshakeInterruptedOnError(pSslSocket, error); }); |