Skip to content
Snippets Groups Projects
Verified Commit 2bd65a09 authored by Iryna Antsyferova's avatar Iryna Antsyferova Committed by IOPSYS Dev
Browse files

Flush pending transmissions to finalize previous TLS sessions, REF 16834

This commit fixes the case when Asterisk cycles through SIP servers one by one, trying to
register with TLS transport. The problem is that SIP-TLS remains active and further Register
requests are sent to the previous P-CSCF as well. pjproject has tls->delayed_list for
transmissions that were not successful. Note that these transmissions should remain for 32
seconds (configured in pjsip.conf timer_b = 32000). However, it seems like they remain for a
longer time (forever?). This commit flushes delayed TXs.
parent 50874946
No related branches found
No related tags found
1 merge request!344Flush pending TXs to finalize previous TLS sessions, REF 16834
diff --git a/pjsip/src/pjsip/sip_transport_tls.c b/pjsip/src/pjsip/sip_transport_tls.c
index 2c969a31c..73917945e 100644
--- a/pjsip/src/pjsip/sip_transport_tls.c
+++ b/pjsip/src/pjsip/sip_transport_tls.c
@@ -175,6 +175,7 @@ static void tls_on_destroy(void *arg);
static void wipe_buf(pj_str_t *buf);
+static void tls_flush_pending_tx(struct tls_transport *tls);
static void tls_perror(const char *sender, const char *title,
pj_status_t status, pj_str_t *remote_name)
@@ -244,7 +245,7 @@ static void tls_init_shutdown(struct tls_transport *tls, pj_status_t status)
tls->close_reason = status;
if (tls->base.is_shutdown || tls->base.is_destroying)
- return;
+ goto End;
/* Prevent immediate transport destroy by application, as transport
* state notification callback may be stacked and transport instance
@@ -277,7 +278,7 @@ static void tls_init_shutdown(struct tls_transport *tls, pj_status_t status)
/* check again */
if (tls->base.is_shutdown || tls->base.is_destroying) {
pjsip_transport_dec_ref(&tls->base);
- return;
+ goto End;
}
/* We can not destroy the transport since high level objects may
@@ -289,6 +290,9 @@ static void tls_init_shutdown(struct tls_transport *tls, pj_status_t status)
/* Now, it is ok to destroy the transport. */
pjsip_transport_dec_ref(&tls->base);
+
+End:
+ tls_flush_pending_tx(tls);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment