summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2020-06-24 09:50:59 +0300
committerdefanor <defanor@uberspace.net>2020-06-24 09:50:59 +0300
commitf9c2810adb8e19a228535ea7c8b131a5e8b6928e (patch)
tree9b023d1d5b6e0da8558034789833fd6c009f381f
parent25385f15c3d51b9587648c2d6fbd9607240705db (diff)
Don't deinit gnutls session on REXMPP_TLS_AWAITING_DIRECT
-rw-r--r--src/rexmpp.c5
1 files 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;