diff options
author | Benny Prijono <bennylp@teluu.com> | 2012-03-30 07:10:13 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2012-03-30 07:10:13 +0000 |
commit | 6b4964727bffb379aca9601e1cf69051ccbf600c (patch) | |
tree | 1d9739ea8b3b5e0421f1d99b39e798b1514fb644 /pjsip/src/pjsip/sip_transaction.c | |
parent | 85ac546acb235df62169c4ad317da74a62e56a88 (diff) |
Re #1474: Merged all changes from 1.12 - HEAD (from the 1.x branch)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3999 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsip/sip_transaction.c')
-rw-r--r-- | pjsip/src/pjsip/sip_transaction.c | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c index c127162b..3acef980 100644 --- a/pjsip/src/pjsip/sip_transaction.c +++ b/pjsip/src/pjsip/sip_transaction.c @@ -714,23 +714,17 @@ static pj_status_t mod_tsx_layer_stop(void) } pj_mutex_unlock(mod_tsx_layer.mutex); + + PJ_LOG(4,(THIS_FILE, "Stopped transaction layer module")); + return PJ_SUCCESS; } -/* This module callback is called when module is being unloaded by - * endpoint. - */ -static pj_status_t mod_tsx_layer_unload(void) +/* Destroy this module */ +static void tsx_layer_destroy(pjsip_endpoint *endpt) { - /* Only self destroy when there's no transaction in the table. - * Transaction may refuse to destroy when it has pending - * transmission. If we destroy the module now, application will - * crash when the pending transaction finally got error response - * from transport and when it tries to unregister itself. - */ - if (pj_hash_count(mod_tsx_layer.htable) != 0) - return PJ_EBUSY; + PJ_UNUSED_ARG(endpt); /* Destroy mutex. */ pj_mutex_destroy(mod_tsx_layer.mutex); @@ -745,6 +739,31 @@ static pj_status_t mod_tsx_layer_unload(void) mod_tsx_layer.endpt = NULL; PJ_LOG(4,(THIS_FILE, "Transaction layer module destroyed")); +} + + +/* This module callback is called when module is being unloaded by + * endpoint. + */ +static pj_status_t mod_tsx_layer_unload(void) +{ + /* Only self destroy when there's no transaction in the table. + * Transaction may refuse to destroy when it has pending + * transmission. If we destroy the module now, application will + * crash when the pending transaction finally got error response + * from transport and when it tries to unregister itself. + */ + if (pj_hash_count(mod_tsx_layer.htable) != 0) { + if (pjsip_endpt_atexit(mod_tsx_layer.endpt, &tsx_layer_destroy) != + PJ_SUCCESS) + { + PJ_LOG(3,(THIS_FILE, "Failed to register transaction layer " + "module destroy.")); + } + return PJ_EBUSY; + } + + tsx_layer_destroy(mod_tsx_layer.endpt); return PJ_SUCCESS; } @@ -3239,7 +3258,10 @@ static pj_status_t tsx_on_state_destroyed(pjsip_transaction *tsx, { PJ_UNUSED_ARG(tsx); PJ_UNUSED_ARG(event); - pj_assert(!"Not expecting any events!!"); - return PJ_EBUG; + + // See https://trac.pjsip.org/repos/ticket/1432 + //pj_assert(!"Not expecting any events!!"); + + return PJ_EIGNORED; } |