- Timestamp:
- Feb 20, 2017 1:16:58 AM (8 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_transport.h
r5308 r5556 904 904 905 905 /** 906 * Start shutdown procedure for this transport. If \a force is false, 907 * the API is the same as #pjsip_transport_shutdown(), while 908 * if \a force is true, existing transport users will immediately 909 * receive PJSIP_TP_STATE_DISCONNECTED notification and should not 910 * use the transport anymore. In either case, transport will 911 * only be destroyed after all objects release their references. 912 * 913 * @param tp The transport. 914 * @param force Force transport to immediately send 915 * disconnection state notification. 916 * 917 * @return PJ_SUCCESS on success. 918 */ 919 PJ_DECL(pj_status_t) pjsip_transport_shutdown2(pjsip_transport *tp, 920 pj_bool_t force); 921 922 /** 906 923 * Destroy a transport when there is no object currently uses the transport. 907 924 * This function is normally called internally by transport manager or the -
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r5400 r5556 1164 1164 PJ_DEF(pj_status_t) pjsip_transport_shutdown(pjsip_transport *tp) 1165 1165 { 1166 return pjsip_transport_shutdown2(tp, PJ_FALSE); 1167 } 1168 1169 1170 /* 1171 * Start shutdown procedure for this transport. 1172 */ 1173 PJ_DEF(pj_status_t) pjsip_transport_shutdown2(pjsip_transport *tp, 1174 pj_bool_t force) 1175 { 1166 1176 pjsip_tpmgr *mgr; 1167 1177 pj_status_t status; 1168 1178 pjsip_tp_state_callback state_cb; 1169 1179 1170 TRACE_((THIS_FILE, "Transport %s shutting down", tp->obj_name)); 1180 PJ_LOG(4, (THIS_FILE, "Transport %s shutting down, force=%d", 1181 tp->obj_name, force)); 1171 1182 1172 1183 pj_lock_acquire(tp->lock); … … 1188 1199 status = tp->do_shutdown(tp); 1189 1200 1201 if (status == PJ_SUCCESS) 1202 tp->is_shutdown = PJ_TRUE; 1203 1190 1204 /* Notify application of transport shutdown */ 1191 1205 state_cb = pjsip_tpmgr_get_state_cb(tp->tpmgr); … … 1194 1208 1195 1209 pj_bzero(&state_info, sizeof(state_info)); 1196 state_info.status = status; 1197 (*state_cb)(tp, PJSIP_TP_STATE_SHUTDOWN, &state_info); 1198 } 1199 1200 if (status == PJ_SUCCESS) 1201 tp->is_shutdown = PJ_TRUE; 1210 state_info.status = PJ_ECANCELLED; 1211 (*state_cb)(tp, (force? PJSIP_TP_STATE_DISCONNECTED: 1212 PJSIP_TP_STATE_SHUTDOWN), &state_info); 1213 } 1202 1214 1203 1215 /* If transport reference count is zero, start timer count-down */
Note: See TracChangeset
for help on using the changeset viewer.