From 247902b01386925a7580306a7d4aefb42702ee31 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Mon, 1 Oct 2007 12:22:52 +0000 Subject: Related to ticket #385: bug in 100rel causing 2xx response to be queued indefinitely when UAS previously sent 1xx response with SDP git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1467 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip-ua/sip_100rel.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'pjsip/src/pjsip-ua') diff --git a/pjsip/src/pjsip-ua/sip_100rel.c b/pjsip/src/pjsip-ua/sip_100rel.c index 145eacd1..48798259 100644 --- a/pjsip/src/pjsip-ua/sip_100rel.c +++ b/pjsip/src/pjsip-ua/sip_100rel.c @@ -101,7 +101,6 @@ typedef struct uas_state_t { pj_int32_t cseq; pj_uint32_t rseq; /* Initialized to -1 */ - pj_bool_t has_sdp; tx_data_list_t tx_data_list; unsigned retransmit_count; pj_timer_entry retransmit_timer; @@ -615,6 +614,23 @@ static pjsip_tx_data *clone_tdata(dlg_data *dd, return dst; } +/* Check if pending response has SDP */ +static pj_bool_t has_sdp(dlg_data *dd) +{ + tx_data_list_t *tl; + + tl = dd->uas_state->tx_data_list.next; + while (tl != &dd->uas_state->tx_data_list) { + if (tl->tdata->msg->body) + return PJ_TRUE; + tl = tl->next; + } + + return PJ_FALSE; +} + + +/* Send response reliably */ PJ_DEF(pj_status_t) pjsip_100rel_tx_response(pjsip_inv_session *inv, pjsip_tx_data *tdata) { @@ -678,7 +694,7 @@ PJ_DEF(pj_status_t) pjsip_100rel_tx_response(pjsip_inv_session *inv, responses are acknowledged. */ - if (dd->uas_state && dd->uas_state->has_sdp) { + if (dd->uas_state && has_sdp(dd)) { /* Yes we have transmitted 1xx with SDP reliably. * In this case, must queue the 2xx response. */ @@ -820,10 +836,6 @@ PJ_DEF(pj_status_t) pjsip_100rel_tx_response(pjsip_inv_session *inv, status = PJ_SUCCESS; } - /* Update SDP flag. Need to call this after the response - * is scheduled for transmission. - */ - dd->uas_state->has_sdp |= (tdata->msg->body != NULL); } return status; -- cgit v1.2.3