Changeset 4446 for pjproject/trunk
- Timestamp:
- Mar 21, 2013 6:07:28 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r4444 r4446 1090 1090 prev_state = tsx->state; 1091 1091 1092 /* Release transport as it's no longer working. */ 1093 tsx_update_transport(tsx, NULL); 1094 1092 1095 if (tsx->status_code < 200) { 1093 1096 pj_str_t err; … … 1916 1919 pj_ssize_t sent) 1917 1920 { 1921 pjsip_transaction *tsx = (pjsip_transaction*) token; 1922 1918 1923 if (sent < 0) { 1919 pj sip_transaction *tsx = (pjsip_transaction*) token;1924 pj_time_val delay = {0, 0}; 1920 1925 char errmsg[PJ_ERR_MSG_SIZE]; 1921 1926 pj_str_t err; 1922 1927 1923 tsx->transport_err = -sent;1924 1925 1928 err = pj_strerror(-sent, errmsg, sizeof(errmsg)); 1926 1929 … … 1928 1931 pjsip_tx_data_get_info(tdata), -sent, errmsg)); 1929 1932 1930 pj_grp_lock_acquire(tsx->grp_lock); 1931 1932 /* Release transport. */ 1933 tsx_update_transport(tsx, NULL); 1934 1935 /* Terminate transaction. */ 1936 tsx_set_status_code(tsx, PJSIP_SC_TSX_TRANSPORT_ERROR, &err); 1937 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 1938 PJSIP_EVENT_TRANSPORT_ERROR, tdata ); 1939 1940 pj_grp_lock_release(tsx->grp_lock); 1933 /* Post the event for later processing, to avoid deadlock. 1934 * See https://trac.pjsip.org/repos/ticket/1646 1935 */ 1936 lock_timer(tsx); 1937 tsx->transport_err = -sent; 1938 tsx_cancel_timer(tsx, &tsx->timeout_timer); 1939 tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay, 1940 TRANSPORT_ERR_TIMER); 1941 unlock_timer(tsx); 1941 1942 } 1943 1944 /* Decrease pending send counter */ 1945 pj_grp_lock_dec_ref(tsx->grp_lock); 1942 1946 } 1943 1947 … … 1993 1997 */ 1994 1998 if (tsx->transport) { 1999 /* Increment group lock while waiting for send operation to complete, 2000 * to prevent us from being destroyed prematurely. See 2001 * https://trac.pjsip.org/repos/ticket/1646 2002 */ 2003 pj_grp_lock_add_ref(tsx->grp_lock); 2004 1995 2005 status = pjsip_transport_send( tsx->transport, tdata, &tsx->addr, 1996 2006 tsx->addr_len, tsx, … … 1998 2008 if (status == PJ_EPENDING) 1999 2009 status = PJ_SUCCESS; 2010 else { 2011 /* Operation completes immediately */ 2012 pj_grp_lock_dec_ref(tsx->grp_lock); 2013 } 2000 2014 2001 2015 if (status != PJ_SUCCESS) {
Note: See TracChangeset
for help on using the changeset viewer.