summaryrefslogtreecommitdiff
path: root/src/rexmpp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rexmpp.c')
-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;