From 7ec442cba4e192d02cf5782899b8c679a3a46e88 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Thu, 26 Mar 2015 02:51:19 +0000 Subject: Re #1828: - Fixed failing regc test in pjsip-test due to modification in #1819. - Fixed assertion in destruction of SIP transport loop. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5024 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip/sip_transport_loop.c | 4 +++- pjsip/src/test/regc_test.c | 42 ++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/pjsip/src/pjsip/sip_transport_loop.c b/pjsip/src/pjsip/sip_transport_loop.c index a612eece..04475154 100644 --- a/pjsip/src/pjsip/sip_transport_loop.c +++ b/pjsip/src/pjsip/sip_transport_loop.c @@ -222,7 +222,9 @@ static pj_status_t loop_destroy(pjsip_transport *tp) loop->thread_quit_flag = 1; /* Unlock transport mutex before joining thread. */ - pj_lock_release(tp->lock); + /// This raised assertion failed "mutex->owner == pj_thread_this()", + /// where mutex->owner==NULL + //pj_lock_release(tp->lock); pj_thread_join(loop->thread); pj_thread_destroy(loop->thread); diff --git a/pjsip/src/test/regc_test.c b/pjsip/src/test/regc_test.c index 18abfed1..d503a789 100644 --- a/pjsip/src/test/regc_test.c +++ b/pjsip/src/test/regc_test.c @@ -370,14 +370,14 @@ static int do_test(const char *title, client_cfg->have_reg, client_result.have_reg)); return -260; } - if (client_result.interval != client_result.expiration) { + if (client_result.have_reg && client_result.interval != client_result.expiration) { PJ_LOG(3,(THIS_FILE, " error: interval (%d) is different than expiration (%d)", client_result.interval, client_result.expiration)); return -270; } - if (client_result.expiration > 0 && client_result.next_reg < 1) { - PJ_LOG(3,(THIS_FILE, " error: next_reg=%d, expecting positive number because expiration is %d", - client_result.next_reg, client_result.expiration)); + if (client_result.interval > 0 && client_result.next_reg < 1) { + PJ_LOG(3,(THIS_FILE, " error: next_reg=%d, expecting positive number because interval is %d", + client_result.next_reg, client_result.interval)); return -280; } @@ -402,7 +402,7 @@ static int keep_alive_test(const pj_str_t *registrar_uri) { PJ_TRUE, 200, PJ_FALSE, EXACT, TIMEOUT, 0, {NULL, 0}}; struct client client_cfg = /* error code have_reg expiration contact_cnt auth? destroy*/ - { PJ_FALSE, 200, PJ_TRUE, TIMEOUT, 1, PJ_FALSE,PJ_FALSE}; + { PJ_FALSE, 200, PJ_TRUE, TIMEOUT, 1, PJ_FALSE,PJ_FALSE}; pj_str_t contact = pj_str(""); @@ -479,7 +479,7 @@ static int refresh_error(const pj_str_t *registrar_uri, { PJ_TRUE, 200, PJ_FALSE, EXACT, TIMEOUT, 0, {NULL, 0}}; struct client client_cfg = /* error code have_reg expiration contact_cnt auth? destroy*/ - { PJ_FALSE, 200, PJ_TRUE, TIMEOUT, 1, PJ_FALSE,PJ_FALSE}; + { PJ_FALSE, 200, PJ_TRUE, TIMEOUT, 1, PJ_FALSE,PJ_FALSE}; pj_str_t contact = pj_str(""); pjsip_regc *regc; @@ -536,7 +536,7 @@ static int update_test(const pj_str_t *registrar_uri) { PJ_TRUE, 200, PJ_FALSE, EXACT, TIMEOUT, 0, {NULL, 0}}; struct client client_cfg = /* error code have_reg expiration contact_cnt auth? destroy*/ - { PJ_FALSE, 200, PJ_TRUE, TIMEOUT, 1, PJ_FALSE,PJ_FALSE}; + { PJ_FALSE, 200, PJ_TRUE, TIMEOUT, 1, PJ_FALSE,PJ_FALSE}; pj_str_t contacts[] = { { "", 7 }, { "", 7 }, @@ -709,10 +709,10 @@ static int auth_send_error(const pj_str_t *registrar_uri, enum { TIMEOUT = 40 }; struct registrar_cfg server_cfg = /* respond code auth contact exp_prm expires more_contacts */ - { PJ_TRUE, 200, PJ_TRUE, EXACT, 75, 0, {NULL, 0}}; + { PJ_TRUE, 200, PJ_TRUE, EXACT, 75, 0, {NULL, 0}}; struct client client_cfg = /* error code have_reg expiration contact_cnt auth? destroy*/ - { PJ_TRUE, 401, PJ_FALSE, -1, 0, PJ_TRUE, PJ_TRUE}; + { PJ_TRUE, 401, PJ_FALSE, TIMEOUT, 0, PJ_TRUE, PJ_TRUE}; pj_str_t contact = pj_str(""); pjsip_regc *regc; @@ -774,7 +774,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 502, PJ_FALSE, -1, 0, PJ_FALSE} + { PJ_FALSE, 502, PJ_FALSE, 600, 0, PJ_FALSE} }, /* timeout test */ @@ -793,7 +793,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth? */ - { PJ_FALSE, 408, PJ_FALSE, -1, 0, PJ_FALSE} + { PJ_FALSE, 408, PJ_FALSE, 600, 0, PJ_FALSE} }, /* Basic successful registration scenario: @@ -816,7 +816,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 200, PJ_TRUE, 75, 1, PJ_FALSE} + { PJ_FALSE, 200, PJ_TRUE, 75, 1, PJ_FALSE} }, /* Basic successful registration scenario with authentication @@ -836,7 +836,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 200, PJ_TRUE, 75, 1, PJ_TRUE} + { PJ_FALSE, 200, PJ_TRUE, 75, 1, PJ_TRUE} }, /* a good registrar returns the Contact header as is and @@ -854,11 +854,11 @@ int regc_test(void) /* registrar config: */ /* respond code auth contact exp_prm expires more_contacts */ - { PJ_TRUE, 200, PJ_FALSE, EXACT, 75, 65, {";expires=70", 0}}, + { PJ_TRUE, 200, PJ_FALSE, EXACT, 75, 65, {";expires=70", 0}}, /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 200, PJ_TRUE, 75, 2, PJ_FALSE} + { PJ_FALSE, 200, PJ_TRUE, 75, 2, PJ_FALSE} }, @@ -883,7 +883,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 200, PJ_TRUE, 75, 1, PJ_FALSE} + { PJ_FALSE, 200, PJ_TRUE, 75, 1, PJ_FALSE} }, @@ -909,7 +909,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 200, PJ_TRUE, 75, 2, PJ_FALSE} + { PJ_FALSE, 200, PJ_TRUE, 75, 2, PJ_FALSE} }, @@ -933,7 +933,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 202, PJ_TRUE, 75, 1, PJ_FALSE} + { PJ_FALSE, 202, PJ_TRUE, 75, 1, PJ_FALSE} }, @@ -957,7 +957,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 200, PJ_TRUE, 65, 2, PJ_FALSE} + { PJ_FALSE, 200, PJ_TRUE, 65, 2, PJ_FALSE} }, /* the registrar doesn't return any bindings, but for some @@ -979,7 +979,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 200, PJ_TRUE, 65, 0, PJ_FALSE} + { PJ_FALSE, 200, PJ_TRUE, 65, 0, PJ_FALSE} }, /* Neither Contact header nor Expires header are present. @@ -1000,7 +1000,7 @@ int regc_test(void) /* client expected results: */ /* error code have_reg expiration contact_cnt auth?*/ - { PJ_FALSE, 200, PJ_TRUE, 600, 0, PJ_FALSE} + { PJ_FALSE, 200, PJ_TRUE, 600, 0, PJ_FALSE} }, }; -- cgit v1.2.3