Changeset 4444
- Timestamp:
- Mar 20, 2013 11:02:45 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r4438 r4444 134 134 (64*PJSIP_T1_TIMEOUT)%1000 }; 135 135 136 #define TIMER_INACTIVE 0 137 #define TIMER_ACTIVE 1 136 #define TIMER_INACTIVE 0 137 #define RETRANSMIT_TIMER 1 138 #define TIMEOUT_TIMER 2 139 #define TRANSPORT_ERR_TIMER 3 138 140 139 141 … … 165 167 pjsip_transport_state state, 166 168 const pjsip_transport_state_info *info); 169 static void tsx_set_state( pjsip_transaction *tsx, 170 pjsip_tsx_state_e state, 171 pjsip_event_id_e event_src_type, 172 void *event_src ); 173 static void tsx_set_state_no_notify( pjsip_transaction *tsx, 174 pjsip_tsx_state_e state, 175 pjsip_event_id_e event_src_type, 176 void *event_src ); 177 static void tsx_set_status_code(pjsip_transaction *tsx, 178 int code, const pj_str_t *reason); 167 179 static pj_status_t tsx_create( pjsip_module *tsx_user, 168 180 pj_grp_lock_t *grp_lock, … … 921 933 } 922 934 935 /* Utility: schedule a timer */ 936 static pj_status_t tsx_schedule_timer(pjsip_transaction *tsx, 937 pj_timer_entry *entry, 938 const pj_time_val *delay, 939 int active_id) 940 { 941 pj_timer_heap_t *timer_heap = pjsip_endpt_get_timer_heap(tsx->endpt); 942 pj_status_t status; 943 944 pj_assert(active_id != 0); 945 status = pj_timer_heap_schedule_w_grp_lock(timer_heap, entry, 946 delay, active_id, 947 tsx->grp_lock); 948 949 return status; 950 } 951 952 /* Utility: cancel a timer */ 953 static int tsx_cancel_timer(pjsip_transaction *tsx, 954 pj_timer_entry *entry) 955 { 956 pj_timer_heap_t *timer_heap = pjsip_endpt_get_timer_heap(tsx->endpt); 957 return pj_timer_heap_cancel_if_active(timer_heap, entry, TIMER_INACTIVE); 958 } 959 923 960 /* Create and initialize basic transaction structure. 924 961 * This function is called by both UAC and UAS creation. … … 947 984 948 985 tsx->handle_200resp = 1; 949 tsx->retransmit_timer.id = 0;986 tsx->retransmit_timer.id = TIMER_INACTIVE; 950 987 tsx->retransmit_timer.user_data = tsx; 951 988 tsx->retransmit_timer.cb = &tsx_timer_callback; 952 tsx->timeout_timer.id = 0;989 tsx->timeout_timer.id = TIMER_INACTIVE; 953 990 tsx->timeout_timer.user_data = tsx; 954 991 tsx->timeout_timer.cb = &tsx_timer_callback; … … 1006 1043 } 1007 1044 /* Cancel timeout timer. */ 1008 if (tsx->timeout_timer.id != 0) { 1009 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1010 tsx->timeout_timer.id = 0; 1011 } 1045 tsx_cancel_timer(tsx, &tsx->timeout_timer); 1046 1012 1047 /* Cancel retransmission timer. */ 1013 if (tsx->retransmit_timer.id != 0) { 1014 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1015 tsx->retransmit_timer.id = 0; 1016 } 1048 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 1017 1049 1018 1050 /* Clear some pending flags. */ … … 1040 1072 1041 1073 /* 1042 * Callback when timer expires. 1074 * Callback when timer expires. Transport error also piggybacks this event 1075 * to avoid deadlock (https://trac.pjsip.org/repos/ticket/1646). 1043 1076 */ 1044 1077 static void tsx_timer_callback( pj_timer_heap_t *theap, pj_timer_entry *entry) 1045 1078 { 1046 pjsip_event event;1047 1079 pjsip_transaction *tsx = (pjsip_transaction*) entry->user_data; 1048 1080 1049 1081 PJ_UNUSED_ARG(theap); 1050 1082 1051 entry->id = 0; 1052 1053 PJ_LOG(5,(tsx->obj_name, "%s timer event", 1054 (entry==&tsx->retransmit_timer ? "Retransmit":"Timeout"))); 1055 pj_log_push_indent(); 1056 1057 1058 PJSIP_EVENT_INIT_TIMER(event, entry); 1059 1060 /* Dispatch event to transaction. */ 1061 pj_grp_lock_acquire(tsx->grp_lock); 1062 (*tsx->state_handler)(tsx, &event); 1063 pj_grp_lock_release(tsx->grp_lock); 1064 1065 pj_log_pop_indent(); 1083 if (entry->id == TRANSPORT_ERR_TIMER) { 1084 /* Posted transport error event */ 1085 entry->id = 0; 1086 if (tsx->state < PJSIP_TSX_STATE_TERMINATED) { 1087 pjsip_tsx_state_e prev_state; 1088 1089 pj_grp_lock_acquire(tsx->grp_lock); 1090 prev_state = tsx->state; 1091 1092 if (tsx->status_code < 200) { 1093 pj_str_t err; 1094 char errmsg[PJ_ERR_MSG_SIZE]; 1095 1096 err = pj_strerror(tsx->transport_err, errmsg, sizeof(errmsg)); 1097 tsx_set_status_code(tsx, PJSIP_SC_TSX_TRANSPORT_ERROR, &err); 1098 } 1099 1100 /* Set transaction state etc, but don't notify TU now, 1101 * otherwise we'll get a deadlock. See: 1102 * https://trac.pjsip.org/repos/ticket/1646 1103 */ 1104 tsx_set_state_no_notify( tsx, PJSIP_TSX_STATE_TERMINATED, 1105 PJSIP_EVENT_TRANSPORT_ERROR, NULL); 1106 pj_grp_lock_release(tsx->grp_lock); 1107 1108 /* Now notify TU about state change, WITHOUT holding the 1109 * group lock. It should be safe to do so; transaction will 1110 * not get destroyed because group lock reference counter 1111 * has been incremented by the timer heap. 1112 */ 1113 if (tsx->tsx_user && tsx->tsx_user->on_tsx_state) { 1114 pjsip_event e; 1115 PJSIP_EVENT_INIT_TSX_STATE(e, tsx, 1116 PJSIP_EVENT_TRANSPORT_ERROR, NULL, 1117 prev_state); 1118 (*tsx->tsx_user->on_tsx_state)(tsx, &e); 1119 } 1120 } 1121 } else { 1122 pjsip_event event; 1123 1124 entry->id = 0; 1125 1126 PJ_LOG(5,(tsx->obj_name, "%s timer event", 1127 (entry==&tsx->retransmit_timer ? "Retransmit":"Timeout"))); 1128 pj_log_push_indent(); 1129 1130 1131 PJSIP_EVENT_INIT_TIMER(event, entry); 1132 1133 /* Dispatch event to transaction. */ 1134 pj_grp_lock_acquire(tsx->grp_lock); 1135 (*tsx->state_handler)(tsx, &event); 1136 pj_grp_lock_release(tsx->grp_lock); 1137 1138 pj_log_pop_indent(); 1139 } 1066 1140 } 1067 1141 … … 1141 1215 1142 1216 lock_timer(tsx); 1143 1144 /* Cancel timeout timer. */ 1145 if (tsx->timeout_timer.id != 0) { 1146 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1147 tsx->timeout_timer.id = 0; 1148 } 1149 1150 tsx->timeout_timer.id = TIMER_ACTIVE; 1151 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1152 &timeout); 1153 1217 tsx_cancel_timer(tsx, &tsx->timeout_timer); 1218 tsx_schedule_timer( tsx, &tsx->timeout_timer, &timeout, TIMEOUT_TIMER); 1154 1219 unlock_timer(tsx); 1155 1220 … … 1166 1231 } 1167 1232 1233 /* Set transaction state without notifying tsx_user */ 1234 static void tsx_set_state_no_notify( pjsip_transaction *tsx, 1235 pjsip_tsx_state_e state, 1236 pjsip_event_id_e event_src_type, 1237 void *event_src ) 1238 { 1239 pjsip_module *tsx_user = tsx->tsx_user; 1240 tsx->tsx_user = NULL; 1241 tsx_set_state(tsx, state, event_src_type, event_src); 1242 tsx->tsx_user = tsx_user; 1243 } 1168 1244 1169 1245 /* … … 1551 1627 pj_grp_lock_acquire(tsx->grp_lock); 1552 1628 /* Cancel retransmission timer. */ 1553 if (tsx->retransmit_timer.id != 0) { 1554 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1555 tsx->retransmit_timer.id = 0; 1556 } 1629 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 1557 1630 pj_grp_lock_release(tsx->grp_lock); 1558 1631 … … 1592 1665 } 1593 1666 1594 if (tsx->timeout_timer.id != 0) { 1595 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1596 tsx->timeout_timer.id = 0; 1597 } 1667 tsx_cancel_timer(tsx, &tsx->timeout_timer); 1598 1668 1599 1669 timeout.sec = 0; … … 1601 1671 pj_time_val_normalize(&timeout); 1602 1672 1603 tsx->timeout_timer.id = TIMER_ACTIVE; 1604 pjsip_endpt_schedule_timer(tsx->endpt, &tsx->timeout_timer, 1605 &timeout); 1606 1673 tsx_schedule_timer(tsx, &tsx->timeout_timer, &timeout, TIMEOUT_TIMER); 1607 1674 1608 1675 unlock_timer(tsx); … … 1829 1896 if (tsx->timeout_timer.id) { 1830 1897 lock_timer(tsx); 1831 1832 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1833 tsx->timeout_timer.id = TIMER_INACTIVE; 1834 1835 tsx->timeout_timer.id = TIMER_ACTIVE; 1836 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1837 &timeout_timer_val); 1838 1898 tsx_cancel_timer(tsx, &tsx->timeout_timer); 1899 tsx_schedule_timer( tsx, &tsx->timeout_timer, 1900 &timeout_timer_val, TIMEOUT_TIMER); 1839 1901 unlock_timer(tsx); 1840 1902 } … … 1892 1954 if (state == PJSIP_TP_STATE_DISCONNECTED) { 1893 1955 pjsip_transaction *tsx; 1956 pj_time_val delay = {0, 0}; 1894 1957 1895 1958 pj_assert(tp && info && info->user_data); … … 1897 1960 tsx = (pjsip_transaction*)info->user_data; 1898 1961 1899 pj_grp_lock_acquire(tsx->grp_lock); 1900 1901 /* Terminate transaction when transport disconnected */ 1902 if (tsx->state < PJSIP_TSX_STATE_TERMINATED) { 1903 pj_str_t err; 1904 char errmsg[PJ_ERR_MSG_SIZE]; 1905 1906 err = pj_strerror(info->status, errmsg, sizeof(errmsg)); 1907 tsx_set_status_code(tsx, PJSIP_SC_TSX_TRANSPORT_ERROR, &err); 1908 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 1909 PJSIP_EVENT_TRANSPORT_ERROR, NULL); 1910 } 1911 1912 pj_grp_lock_release(tsx->grp_lock); 1962 /* Post the event for later processing, to avoid deadlock. 1963 * See https://trac.pjsip.org/repos/ticket/1646 1964 */ 1965 lock_timer(tsx); 1966 tsx->transport_err = info->status; 1967 tsx_cancel_timer(tsx, &tsx->timeout_timer); 1968 tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay, 1969 TRANSPORT_ERR_TIMER); 1970 unlock_timer(tsx); 1913 1971 } 1914 1972 } … … 2119 2177 timeout.sec = msec_time / 1000; 2120 2178 timeout.msec = msec_time % 1000; 2121 tsx->retransmit_timer.id = TIMER_ACTIVE; 2122 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->retransmit_timer, 2123 &timeout); 2179 tsx_schedule_timer( tsx, &tsx->retransmit_timer, &timeout, 2180 RETRANSMIT_TIMER); 2124 2181 } 2125 2182 } … … 2188 2245 } 2189 2246 2190 2191 2247 /* 2192 2248 * Handler for events in state Null. … … 2241 2297 */ 2242 2298 lock_timer(tsx); 2243 tsx->timeout_timer.id = TIMER_ACTIVE; 2244 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 2245 &timeout_timer_val); 2299 tsx_schedule_timer( tsx, &tsx->timeout_timer, &timeout_timer_val, 2300 TIMEOUT_TIMER); 2246 2301 unlock_timer(tsx); 2247 2302 … … 2254 2309 tsx->transport_flag |= TSX_HAS_PENDING_RESCHED; 2255 2310 } else { 2256 tsx->retransmit_timer.id = TIMER_ACTIVE; 2257 pjsip_endpt_schedule_timer(tsx->endpt, &tsx->retransmit_timer, 2258 &t1_timer_val); 2311 tsx_schedule_timer(tsx, &tsx->retransmit_timer, 2312 &t1_timer_val, RETRANSMIT_TIMER); 2259 2313 } 2260 2314 } … … 2293 2347 event->body.timer.entry == &tsx->timeout_timer) 2294 2348 { 2295 2296 2349 /* Cancel retransmission timer. */ 2297 if (tsx->retransmit_timer.id != 0) { 2298 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2299 tsx->retransmit_timer.id = 0; 2300 } 2350 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 2351 2301 2352 tsx->transport_flag &= ~(TSX_HAS_PENDING_RESCHED); 2302 2353 … … 2305 2356 2306 2357 /* Inform TU. */ 2307 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2358 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2308 2359 PJSIP_EVENT_TIMER, &tsx->timeout_timer); 2309 2360 … … 2328 2379 */ 2329 2380 if (code >= 200) { 2330 if (tsx->retransmit_timer.id != 0) { 2331 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2332 tsx->retransmit_timer.id = 0; 2333 } 2381 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 2334 2382 2335 2383 if (tsx->timeout_timer.id != 0) { 2336 2384 lock_timer(tsx); 2337 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 2338 tsx->timeout_timer.id = 0; 2385 tsx_cancel_timer(tsx, &tsx->timeout_timer); 2339 2386 unlock_timer(tsx); 2340 2387 } … … 2344 2391 * retransmit timer will be rescheduled at T2. 2345 2392 */ 2346 if (tsx->retransmit_timer.id != 0) { 2347 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2348 tsx->retransmit_timer.id = 0; 2349 } 2393 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 2350 2394 2351 2395 /* For provisional response, only cancel retransmit when this … … 2359 2403 /* Cancel timeout timer */ 2360 2404 lock_timer(tsx); 2361 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer);2405 tsx_cancel_timer(tsx, &tsx->timeout_timer); 2362 2406 unlock_timer(tsx); 2363 2407 2364 2408 } else { 2365 2409 if (!tsx->is_reliable) { 2366 tsx->retransmit_timer.id = TIMER_ACTIVE; 2367 pjsip_endpt_schedule_timer(tsx->endpt, 2368 &tsx->retransmit_timer, 2369 &t2_timer_val); 2410 tsx_schedule_timer(tsx, &tsx->retransmit_timer, 2411 &t2_timer_val, RETRANSMIT_TIMER); 2370 2412 } 2371 2413 } … … 2525 2567 2526 2568 /* Stop 1xx retransmission timer, if any */ 2527 if (tsx->retransmit_timer.id) { 2528 pjsip_endpt_cancel_timer(tsx->endpt, 2529 &tsx->retransmit_timer); 2530 tsx->retransmit_timer.id = 0; 2531 } 2569 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 2532 2570 2533 2571 /* Schedule retransmission */ … … 2537 2575 } else { 2538 2576 pj_time_val delay = {PJSIP_TSX_1XX_RETRANS_DELAY, 0}; 2539 2540 tsx->retransmit_timer.id = TIMER_ACTIVE; 2541 pjsip_endpt_schedule_timer( tsx->endpt, 2542 &tsx->retransmit_timer, 2543 &delay); 2577 tsx_schedule_timer( tsx, &tsx->retransmit_timer, &delay, 2578 RETRANSMIT_TIMER); 2544 2579 } 2545 2580 } … … 2548 2583 2549 2584 /* Stop 1xx retransmission timer, if any */ 2550 if (tsx->retransmit_timer.id) { 2551 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2552 tsx->retransmit_timer.id = 0; 2553 } 2585 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 2554 2586 2555 2587 if (tsx->method.id == PJSIP_INVITE_METHOD && tsx->handle_200resp==0) { … … 2572 2604 tsx->transport_flag |= TSX_HAS_PENDING_RESCHED; 2573 2605 } else { 2574 tsx->retransmit_timer.id = TIMER_ACTIVE; 2575 pjsip_endpt_schedule_timer( tsx->endpt, 2576 &tsx->retransmit_timer, 2577 &t1_timer_val); 2606 tsx_schedule_timer( tsx, &tsx->retransmit_timer, 2607 &t1_timer_val, RETRANSMIT_TIMER); 2578 2608 } 2579 2609 } … … 2612 2642 2613 2643 lock_timer(tsx); 2614 tsx->timeout_timer.id = TIMER_ACTIVE; 2615 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 2616 &timeout); 2644 tsx_schedule_timer( tsx, &tsx->timeout_timer, 2645 &timeout, TIMEOUT_TIMER); 2617 2646 unlock_timer(tsx); 2618 2647 … … 2625 2654 2626 2655 /* Stop 1xx retransmission timer, if any */ 2627 if (tsx->retransmit_timer.id) { 2628 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2629 tsx->retransmit_timer.id = 0; 2630 } 2656 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 2631 2657 2632 2658 /* 3xx-6xx class message causes transaction to move to … … 2646 2672 if (tsx->method.id == PJSIP_INVITE_METHOD) { 2647 2673 /* Start timer H for INVITE */ 2648 tsx->timeout_timer.id = TIMER_ACTIVE; 2649 pjsip_endpt_schedule_timer(tsx->endpt,&tsx->timeout_timer, 2650 &timeout_timer_val); 2674 tsx_schedule_timer(tsx, &tsx->timeout_timer, 2675 &timeout_timer_val, TIMEOUT_TIMER); 2651 2676 } else if (!tsx->is_reliable) { 2652 2677 /* Start timer J on 64*T1 seconds for non-INVITE */ 2653 tsx->timeout_timer.id = TIMER_ACTIVE; 2654 pjsip_endpt_schedule_timer(tsx->endpt,&tsx->timeout_timer, 2655 &timeout_timer_val); 2678 tsx_schedule_timer(tsx, &tsx->timeout_timer, 2679 &timeout_timer_val, TIMEOUT_TIMER); 2656 2680 } else { 2657 2681 /* Start timer J on zero seconds for non-INVITE */ 2658 2682 pj_time_val zero_time = { 0, 0 }; 2659 tsx->timeout_timer.id = TIMER_ACTIVE; 2660 pjsip_endpt_schedule_timer(tsx->endpt,&tsx->timeout_timer, 2661 &zero_time); 2683 tsx_schedule_timer(tsx, &tsx->timeout_timer, 2684 &zero_time, TIMEOUT_TIMER); 2662 2685 } 2663 2686 unlock_timer(tsx); … … 2675 2698 tsx->transport_flag |= TSX_HAS_PENDING_RESCHED; 2676 2699 } else { 2677 tsx->retransmit_timer.id = TIMER_ACTIVE; 2678 pjsip_endpt_schedule_timer(tsx->endpt, 2679 &tsx->retransmit_timer, 2680 &t1_timer_val); 2700 tsx_schedule_timer(tsx, &tsx->retransmit_timer, 2701 &t1_timer_val, RETRANSMIT_TIMER); 2681 2702 } 2682 2703 } … … 2718 2739 tsx_set_status_code(tsx, PJSIP_SC_TSX_TIMEOUT, NULL); 2719 2740 2720 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2741 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2721 2742 PJSIP_EVENT_TIMER, &tsx->timeout_timer); 2722 2743 … … 2790 2811 /* Stop timeout timer B/F. */ 2791 2812 lock_timer(tsx); 2792 pjsip_endpt_cancel_timer( tsx->endpt, &tsx->timeout_timer );2813 tsx_cancel_timer( tsx, &tsx->timeout_timer ); 2793 2814 unlock_timer(tsx); 2794 2815 … … 2816 2837 } 2817 2838 lock_timer(tsx); 2818 tsx->timeout_timer.id = TIMER_ACTIVE; 2819 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 2820 &timeout); 2839 tsx_schedule_timer( tsx, &tsx->timeout_timer, 2840 &timeout, TIMEOUT_TIMER); 2821 2841 unlock_timer(tsx); 2822 2842 2823 2843 /* Cancel retransmission timer */ 2824 if (tsx->retransmit_timer.id != 0) { 2825 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2826 tsx->retransmit_timer.id = 0; 2827 } 2844 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 2828 2845 2829 2846 /* Move state to Completed, inform TU. */ … … 2836 2853 2837 2854 /* Inform TU. */ 2838 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2855 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2839 2856 PJSIP_EVENT_TIMER, &tsx->timeout_timer); 2840 2857 … … 2852 2869 2853 2870 /* Stop timer B. */ 2854 pjsip_endpt_cancel_timer( tsx->endpt, &tsx->timeout_timer );2871 tsx_cancel_timer( tsx, &tsx->timeout_timer ); 2855 2872 2856 2873 /* Generate and send ACK for INVITE. */ … … 2885 2902 timeout.sec = timeout.msec = 0; 2886 2903 } 2887 tsx->timeout->timer.id = TSX_TIMER_TIMEOUT; 2888 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, &timeout); 2904 tsx_schedule_timer( tsx, &tsx->timeout_timer, &timeout, TIMEOUT_TIMER); 2889 2905 2890 2906 /* Inform TU. … … 2905 2921 2906 2922 /* Cancel retransmission timer */ 2907 if (tsx->retransmit_timer.id != 0) { 2908 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2909 tsx->retransmit_timer.id = 0; 2910 } 2923 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 2911 2924 2912 2925 /* Stop timer B. */ 2913 2926 lock_timer(tsx); 2914 tsx->timeout_timer.id = 0; 2915 pjsip_endpt_cancel_timer( tsx->endpt, &tsx->timeout_timer ); 2927 tsx_cancel_timer( tsx, &tsx->timeout_timer ); 2916 2928 unlock_timer(tsx); 2917 2929 … … 2966 2978 * https://trac.pjsip.org/repos/ticket/1374 2967 2979 */ 2968 if (tsx->timeout_timer.id) 2969 pjsip_endpt_cancel_timer( tsx->endpt, &tsx->timeout_timer ); 2970 tsx->timeout_timer.id = TIMER_ACTIVE; 2971 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, &timeout); 2980 tsx_cancel_timer( tsx, &tsx->timeout_timer ); 2981 tsx_schedule_timer( tsx, &tsx->timeout_timer, &timeout, 2982 TIMEOUT_TIMER); 2972 2983 unlock_timer(tsx); 2973 2984 … … 3021 3032 3022 3033 /* Cease retransmission. */ 3023 if (tsx->retransmit_timer.id != 0) { 3024 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 3025 tsx->retransmit_timer.id = 0; 3026 } 3034 tsx_cancel_timer(tsx, &tsx->retransmit_timer); 3035 3027 3036 tsx->transport_flag &= ~(TSX_HAS_PENDING_RESCHED); 3028 3037 3029 3038 /* Reschedule timeout timer. */ 3030 3039 lock_timer(tsx); 3031 pjsip_endpt_cancel_timer( tsx->endpt, &tsx->timeout_timer ); 3032 tsx->timeout_timer.id = TIMER_ACTIVE; 3040 tsx_cancel_timer( tsx, &tsx->timeout_timer ); 3033 3041 3034 3042 /* Timer I is T4 timer for unreliable transports, and … … 3042 3050 timeout.msec = t4_timer_val.msec; 3043 3051 } 3044 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer,3045 &timeout);3052 tsx_schedule_timer( tsx, &tsx->timeout_timer, 3053 &timeout, TIMEOUT_TIMER); 3046 3054 unlock_timer(tsx); 3047 3055 … … 3108 3116 3109 3117 /* Move to Terminated state. */ 3110 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 3118 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 3111 3119 PJSIP_EVENT_TIMER, event->body.timer.entry ); 3112 3120 … … 3177 3185 3178 3186 /* Move to Terminated state. */ 3179 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 3187 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 3180 3188 PJSIP_EVENT_TIMER, &tsx->timeout_timer ); 3181 3189
Note: See TracChangeset
for help on using the changeset viewer.