diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2018-08-13 12:15:46 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2018-08-15 18:19:15 +0000 |
commit | b58da27aef4868ebadc14bab714675e72e82ee2a (patch) | |
tree | 2e3a01e781c15fe8f16f714b036ad1576f3a5047 /src/network/ssl/qdtls_openssl.cpp | |
parent | e86b1d44247f87e38f73f0ecc3bdd1607c03cc6c (diff) |
QDtsl::abortHandshake() - generalize the notion of 'abort'
Previously, the function had a different name that made its purpose
clear - "abort after peer verification error was encoutered". Since
now it's just 'abort handshake', it also should abort an ongoing
handshake, even if no peer verification error found so that we
now have an API that can reset a QDtls object to its initial
'nothing done yet' state.
Change-Id: Idadfec6f82d65c8f07d1c2afa4467c921c7e85c4
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/ssl/qdtls_openssl.cpp')
-rw-r--r-- | src/network/ssl/qdtls_openssl.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/network/ssl/qdtls_openssl.cpp b/src/network/ssl/qdtls_openssl.cpp index 9b11f58f2f..1f4b5a0419 100644 --- a/src/network/ssl/qdtls_openssl.cpp +++ b/src/network/ssl/qdtls_openssl.cpp @@ -1115,13 +1115,18 @@ bool QDtlsPrivateOpenSSL::resumeHandshake(QUdpSocket *socket) void QDtlsPrivateOpenSSL::abortHandshake(QUdpSocket *socket) { Q_ASSERT(socket); - Q_ASSERT(handshakeState == QDtls::PeerVerificationFailed); + Q_ASSERT(handshakeState == QDtls::PeerVerificationFailed + || handshakeState == QDtls::HandshakeInProgress); clearDtlsError(); - // Yes, while peer verification failed, we were actually encrypted. - // Let's play it nice - inform our peer about connection shut down. - sendShutdownAlert(socket); + if (handshakeState == QDtls::PeerVerificationFailed) { + // Yes, while peer verification failed, we were actually encrypted. + // Let's play it nice - inform our peer about connection shut down. + sendShutdownAlert(socket); + } else { + resetDtls(); + } } void QDtlsPrivateOpenSSL::sendShutdownAlert(QUdpSocket *socket) |