- Timestamp:
- Jan 25, 2010 1:42:56 PM (15 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_transaction.h
r2646 r3071 98 98 pj_uint32_t hashed_key; /**< Key's hashed value. */ 99 99 pj_str_t branch; /**< The branch Id. */ 100 pjsip_tpselector tp_sel; /**< Transport selector. */101 100 102 101 /* … … 122 121 unsigned transport_flag; /**< Miscelaneous flag. */ 123 122 pj_status_t transport_err; /**< Internal error code. */ 123 pjsip_tpselector tp_sel; /**< Transport selector. */ 124 pjsip_tx_data *pending_tx; /**< Tdata which caused 125 pending transport flag 126 to be set on tsx. */ 124 127 125 128 /* -
pjproject/trunk/pjsip/include/pjsip/sip_transport.h
r2985 r3071 570 570 pjsip_tpselector tp_sel; 571 571 572 /** 573 * Arbitrary data attached by PJSIP modules. 574 */ 575 void *mod_data[PJSIP_MAX_MODULE]; 572 576 }; 573 577 -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r2936 r3071 582 582 static void mod_tsx_layer_unregister_tsx( pjsip_transaction *tsx) 583 583 { 584 if (mod_tsx_layer.mod.id == -1) { 585 /* The transaction layer has been unregistered. This could happen 586 * if the transaction was pending on transport and the application 587 * is shutdown. See http://trac.pjsip.org/repos/ticket/1033. In 588 * this case just do nothing. 589 */ 590 return; 591 } 592 584 593 pj_assert(tsx->transaction_key.slen != 0); 585 594 //pj_assert(tsx->state != PJSIP_TSX_STATE_NULL); … … 1116 1125 pj_time_val timeout = {0, 0}; 1117 1126 1118 /* Reschedule timeout timer to destroy this transaction. */1127 /* If we're still waiting for a message to be sent.. */ 1119 1128 if (tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) { 1120 tsx->transport_flag |= TSX_HAS_PENDING_DESTROY; 1121 } else { 1122 /* Cancel timeout timer. */ 1123 if (tsx->timeout_timer.id != 0) { 1124 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1125 tsx->timeout_timer.id = 0; 1126 } 1127 1128 tsx->timeout_timer.id = TIMER_ACTIVE; 1129 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1130 &timeout); 1131 } 1129 /* Disassociate ourselves from the outstanding transmit data 1130 * so that when the send callback is called we will be able 1131 * to ignore that (otherwise we'll get assertion, see 1132 * http://trac.pjsip.org/repos/ticket/1033) 1133 */ 1134 tsx->pending_tx->mod_data[mod_tsx_layer.mod.id] = NULL; 1135 tsx->pending_tx = NULL; 1136 tsx->transport_flag &= ~(TSX_HAS_PENDING_TRANSPORT); 1137 } 1138 1139 /* Cancel timeout timer. */ 1140 if (tsx->timeout_timer.id != 0) { 1141 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1142 tsx->timeout_timer.id = 0; 1143 } 1144 1145 tsx->timeout_timer.id = TIMER_ACTIVE; 1146 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1147 &timeout); 1132 1148 1133 1149 … … 1637 1653 pjsip_tx_data *tdata = send_state->tdata; 1638 1654 struct tsx_lock_data lck; 1655 1656 /* Check if transaction has cancelled itself from this transmit 1657 * notification (https://trac.pjsip.org/repos/ticket/1033). 1658 */ 1659 if (tdata->mod_data[mod_tsx_layer.mod.id] == NULL) { 1660 return; 1661 } 1662 1663 /* Reset */ 1664 tdata->mod_data[mod_tsx_layer.mod.id] = NULL; 1665 tsx->pending_tx = NULL; 1639 1666 1640 1667 lock_tsx(tsx, &lck); … … 1907 1934 pjsip_tx_data_add_ref(tdata); 1908 1935 1936 /* Also attach ourselves to the transmit data so that we'll be able 1937 * to unregister ourselves from the send notification of this 1938 * transmit data. 1939 */ 1940 tdata->mod_data[mod_tsx_layer.mod.id] = tsx; 1941 tsx->pending_tx = tdata; 1942 1909 1943 /* Begin resolving destination etc to send the message. */ 1910 1944 if (tdata->msg->type == PJSIP_REQUEST_MSG) { … … 1915 1949 if (status == PJ_EPENDING) 1916 1950 status = PJ_SUCCESS; 1917 if (status != PJ_SUCCESS) 1951 if (status != PJ_SUCCESS) { 1918 1952 pjsip_tx_data_dec_ref(tdata); 1953 tdata->mod_data[mod_tsx_layer.mod.id] = NULL; 1954 tsx->pending_tx = NULL; 1955 } 1919 1956 1920 1957 /* Check if transaction is terminated. */ … … 1930 1967 if (status == PJ_EPENDING) 1931 1968 status = PJ_SUCCESS; 1932 if (status != PJ_SUCCESS) 1969 if (status != PJ_SUCCESS) { 1933 1970 pjsip_tx_data_dec_ref(tdata); 1971 tdata->mod_data[mod_tsx_layer.mod.id] = NULL; 1972 tsx->pending_tx = NULL; 1973 } 1934 1974 1935 1975 /* Check if transaction is terminated. */
Note: See TracChangeset
for help on using the changeset viewer.