From f9c2810adb8e19a228535ea7c8b131a5e8b6928e Mon Sep 17 00:00:00 2001 From: defanor Date: Wed, 24 Jun 2020 09:50:59 +0300 Subject: Don't deinit gnutls session on REXMPP_TLS_AWAITING_DIRECT --- src/rexmpp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rexmpp.c b/src/rexmpp.c index 4b7a62c..02dcf5b 100644 --- a/src/rexmpp.c +++ b/src/rexmpp.c @@ -344,10 +344,11 @@ rexmpp_err_t rexmpp_init (rexmpp_t *s, const char *jid) structures), but keeps others (e.g., stanza queue and stream ID, since we may resume the stream afterwards). */ void rexmpp_cleanup (rexmpp_t *s) { - if (s->tls_state != REXMPP_TLS_INACTIVE) { + if (s->tls_state != REXMPP_TLS_INACTIVE && + s->tls_state != REXMPP_TLS_AWAITING_DIRECT) { gnutls_deinit(s->gnutls_session); - s->tls_state = REXMPP_TLS_INACTIVE; } + s->tls_state = REXMPP_TLS_INACTIVE; if (s->sasl_state != REXMPP_SASL_INACTIVE) { gsasl_finish(s->sasl_session); s->sasl_session = NULL; -- cgit v1.2.3