- Timestamp:
- Apr 11, 2007 7:48:42 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/symbian/pjsip/src/pjsip/sip_transaction.c
r789 r1192 126 126 static const pj_time_val t1_timer_val = { PJSIP_T1_TIMEOUT/1000, 127 127 PJSIP_T1_TIMEOUT%1000 }; 128 static const pj_time_val t2_timer_val = { PJSIP_T2_TIMEOUT/1000, 129 PJSIP_T2_TIMEOUT%1000 }; 128 130 static const pj_time_val t4_timer_val = { PJSIP_T4_TIMEOUT/1000, 129 131 PJSIP_T4_TIMEOUT%1000 }; … … 1704 1706 pj_assert((tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) == 0); 1705 1707 1706 msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT; 1708 pj_assert(tsx->status_code < 200); 1709 1710 if (tsx->status_code >= 100) 1711 msec_time = PJSIP_T2_TIMEOUT; 1712 else 1713 msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT; 1707 1714 1708 1715 if (tsx->role == PJSIP_ROLE_UAC) { … … 1879 1886 } else if (event->type == PJSIP_EVENT_RX_MSG) { 1880 1887 pjsip_msg *msg; 1881 //int code;1888 int code; 1882 1889 1883 1890 /* Get message instance */ 1884 1891 msg = event->body.rx_msg.rdata->msg_info.msg; 1885 1892 1886 /* Better be a response message. */ 1887 if (msg->type != PJSIP_RESPONSE_MSG) 1888 return PJSIP_ENOTRESPONSEMSG; 1889 1890 /* Cancel retransmission timer A. */ 1891 if (tsx->retransmit_timer._timer_id != -1) { 1892 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1893 tsx->retransmit_timer._timer_id = -1; 1894 } 1893 code = msg->line.status.code; 1894 1895 /* If the response is final, cancel both retransmission and timeout 1896 * timer. 1897 */ 1898 if (code >= 200) { 1899 if (tsx->retransmit_timer._timer_id != -1) { 1900 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1901 tsx->retransmit_timer._timer_id = -1; 1902 } 1903 1904 if (tsx->timeout_timer._timer_id != -1) { 1905 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1906 tsx->timeout_timer._timer_id = -1; 1907 } 1908 1909 } else { 1910 /* Cancel retransmit timer (for non-INVITE transaction, the 1911 * retransmit timer will be rescheduled at T2. 1912 */ 1913 if (tsx->retransmit_timer._timer_id != -1) { 1914 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1915 tsx->retransmit_timer._timer_id = -1; 1916 } 1917 1918 /* For provisional response, only cancel retransmit when this 1919 * is an INVITE transaction. For non-INVITE, section 17.1.2.1 1920 * of RFC 3261 says that: 1921 * - retransmit timer is set to T2 1922 * - timeout timer F is not deleted. 1923 */ 1924 if (tsx->method.id == PJSIP_INVITE_METHOD) { 1925 1926 /* Cancel timeout timer */ 1927 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1928 1929 } else { 1930 if (!tsx->is_reliable) { 1931 pjsip_endpt_schedule_timer(tsx->endpt, 1932 &tsx->retransmit_timer, 1933 &t2_timer_val); 1934 } 1935 } 1936 } 1937 1895 1938 tsx->transport_flag &= ~(TSX_HAS_PENDING_RESCHED); 1896 1897 1898 /* Cancel timer B (transaction timeout) */1899 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer);1900 1939 1901 1940 /* Discard retransmission message if it is not INVITE. … … 2222 2261 tsx->status_code = msg->line.status.code; 2223 2262 } else { 2224 tsx->status_code = PJSIP_SC_TSX_TIMEOUT; 2263 if (event->body.timer.entry == &tsx->retransmit_timer) { 2264 /* Retransmit message. */ 2265 pj_status_t status; 2266 2267 status = tsx_retransmit( tsx, 1 ); 2268 2269 return status; 2270 2271 } else { 2272 tsx->status_code = PJSIP_SC_TSX_TIMEOUT; 2273 } 2225 2274 } 2226 2275 … … 2266 2315 } 2267 2316 2317 } else if (event->type == PJSIP_EVENT_TIMER && 2318 event->body.timer.entry == &tsx->timeout_timer) { 2319 2320 /* Inform TU. */ 2321 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2322 PJSIP_EVENT_TIMER, &tsx->timeout_timer); 2323 2324 2268 2325 } else if (tsx->status_code >= 300 && tsx->status_code <= 699) { 2269 2326
Note: See TracChangeset
for help on using the changeset viewer.