Commit 416ceea0 authored by Pekka Pessi's avatar Pekka Pessi

nua_session.c: fixed problem of BYE trying to destroy the session usage twice.

Problem reported by Michael Jerris.

darcs-hash:20070326175259-55b16-5a7986506ab5b5c20935fdfbbf96587d79a83770.gz
parent 5b46460b
......@@ -3533,10 +3533,13 @@ static int nua_bye_client_report(nua_client_request_t *cr,
nua_callstate_terminated);
if (ss && !ss->ss_reporting) {
if (nua_client_is_queued(du->du_cr) && du->du_cr->cr_status < 200)
/* No final response to INVITE received yet */;
else
if (du->du_cr == NULL ||
!nua_client_is_queued(du->du_cr) ||
du->du_cr->cr_status >= 200) {
/* INVITE is completed, we can zap the session... */;
cr->cr_usage = NULL;
nua_session_usage_destroy(nh, ss);
}
}
}
......
......@@ -1177,7 +1177,7 @@ int test_call_timeouts(struct context *ctx)
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
struct nat_filter *f;
struct nat_filter *f, *f2;
if (print_headings)
printf("TEST NUA-4.7: check for error and timeout handling\n");
......@@ -1194,6 +1194,8 @@ int test_call_timeouts(struct context *ctx)
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
TEST_1(f = test_nat_add_filter(ctx->nat, filter_200_OK, NULL, nat_inbound));
TEST_1(f2 = test_nat_add_filter(ctx->nat, filter_200_OK,
NULL, nat_outbound));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
......@@ -1215,7 +1217,7 @@ int test_call_timeouts(struct context *ctx)
| X-----200--------|
| |
|<--------BYE--------|
|--------200 OK----->|
|--------200 OK---X |
*/
......@@ -1253,6 +1255,7 @@ int test_call_timeouts(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminating); /* TERMINATING */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
TEST(e->data->e_status, 408);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
......@@ -1263,6 +1266,7 @@ int test_call_timeouts(struct context *ctx)
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
TEST_1(test_nat_remove_filter(ctx->nat, f) == 0);
TEST_1(test_nat_remove_filter(ctx->nat, f2) == 0);
if (print_headings)
printf("TEST NUA-4.7.1: PASSED\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment