From 9c26f7b560df4e97b173097cbc3a06c6fc40afca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Fri, 26 Feb 2021 15:21:25 -0500 Subject: [PATCH] tls_session: avoid to retry handshake if stopped getting a TlsSession::shutdown() while doing a gnutls_handshake provoke a loop (cause the handshake will return GNUTLS_E_INTERRUPTED and will loop until HANDSHAKE_MAX_RETRY). Change-Id: Ifabc24c815552a14781b72cb9baf66d987cb25ce --- src/security/tls_session.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/security/tls_session.cpp b/src/security/tls_session.cpp index beaad1787d..b0693f6071 100644 --- a/src/security/tls_session.cpp +++ b/src/security/tls_session.cpp @@ -1161,7 +1161,8 @@ TlsSession::TlsSessionImpl::handleStateHandshake(TlsSessionState state) JAMI_DBG("[TLS] handshake"); ret = gnutls_handshake(session_); } while ((ret == GNUTLS_E_INTERRUPTED or ret == GNUTLS_E_AGAIN) - and ++retry_count < HANDSHAKE_MAX_RETRY); + and ++retry_count < HANDSHAKE_MAX_RETRY + and state_.load() != TlsSessionState::SHUTDOWN); // Stop on fatal error if (gnutls_error_is_fatal(ret)) { -- GitLab