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. Change-Id: Ie3c9680db2717e21a0c548c74374a58d533534fe Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit fb4123f36a88f6e890ed2e7f9b462665bfdcd6c0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
66167500aa
commit
22c2568af7
@ -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);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user