From 7585c4fafc6929c9fd9d3dfd2c1afe5c285b16d1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 May 2009 18:30:50 +0000 Subject: [PATCH] add checks to find issue in FSCORE-338 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13308 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/libsofia-sip-ua/nta/nta.c | 25 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index a70e74e267..e98fa0e4ba 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -1048,11 +1048,14 @@ void nta_agent_destroy(nta_agent_t *agent) nta_outgoing_t *orq = oht->oht_table[i]; if (!orq->orq_destroyed) - SU_DEBUG_3(("%s: destroying %s client transaction to <" + SU_DEBUG_3(("%s: destroying %s%s client transaction to <" URL_PRINT_FORMAT ">\n", - __func__, orq->orq_method_name, + __func__, + (orq->orq_forking || orq->orq_forks) ? "forked " : "forking", + orq->orq_method_name, URL_PRINT_ARGS(orq->orq_to->a_url))); + orq->orq_forks = NULL, orq->orq_forking = NULL; outgoing_free(orq); } @@ -8493,6 +8496,7 @@ static void outgoing_free(nta_outgoing_t *orq) { SU_DEBUG_9(("nta: outgoing_free(%p)\n", (void *)orq)); + assert(orq->orq_forks == NULL && orq->orq_forking == NULL); outgoing_cut_off(orq); outgoing_reclaim(orq); } @@ -8585,7 +8589,10 @@ int outgoing_default_cb(nta_outgoing_magic_t *magic, void outgoing_destroy(nta_outgoing_t *orq) { if (orq->orq_terminated || orq->orq_default) { - outgoing_free(orq); + if (!orq->orq_forking && !orq->orq_forks) { + outgoing_free(orq); + return; + } } /* Application is expected to handle 200 OK statelessly => kill transaction immediately */ @@ -8596,12 +8603,12 @@ void outgoing_destroy(nta_outgoing_t *orq) && !orq->orq_forking && !orq->orq_forks) { orq->orq_destroyed = 1; outgoing_terminate(orq); + return; } - else { - orq->orq_destroyed = 1; - orq->orq_callback = outgoing_default_cb; - orq->orq_magic = NULL; - } + + orq->orq_destroyed = 1; + orq->orq_callback = outgoing_default_cb; + orq->orq_magic = NULL; } /** @internal Outgoing transaction timer routine. @@ -8882,6 +8889,8 @@ outgoing_terminate_invite(nta_outgoing_t *original) "terminate", orq->orq_method_name, orq->orq_cseq->cs_seq, orq->orq_tag)); + orq->orq_forking = NULL; + if (outgoing_terminate(orq)) continue;