Changeset 5765
- Timestamp:
- Apr 2, 2018 5:43:58 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r5762 r5765 1234 1234 1235 1235 1236 static void destroy_stun_resolve_cb(pj_timer_heap_t *t, pj_timer_entry *e) 1237 { 1238 pjsua_stun_resolve *sess = (pjsua_stun_resolve*)e->user_data; 1239 PJ_UNUSED_ARG(t); 1240 1236 static void release_stun_session(pjsua_stun_resolve *sess) 1237 { 1241 1238 PJSUA_LOCK(); 1242 1239 pj_list_erase(sess); … … 1247 1244 } 1248 1245 1249 1250 static void destroy_stun_resolve(pjsua_stun_resolve *sess) 1246 static void destroy_stun_resolve_cb(pj_timer_heap_t *t, pj_timer_entry *e) 1247 { 1248 pjsua_stun_resolve *sess = (pjsua_stun_resolve*)e->user_data; 1249 PJ_UNUSED_ARG(t); 1250 1251 release_stun_session(sess); 1252 } 1253 1254 1255 static void destroy_stun_resolve(pjsua_stun_resolve *sess, pj_bool_t forced) 1251 1256 { 1252 1257 pj_time_val timeout = {0, 0}; … … 1266 1271 pjsua_var.stun_status = PJNATH_ESTUNDESTROYED; 1267 1272 } 1268 1269 /* Schedule session clean up, it needs PJSUA lock and locking it here 1270 * may cause deadlock as this function may be called by STUN socket 1271 * while holding STUN socket lock, while application may wait for STUN 1272 * resolution while holding PJSUA lock. 1273 */ 1274 pj_timer_entry_init(&sess->timer, 0, (void*)sess, 1275 &destroy_stun_resolve_cb); 1276 pjsua_schedule_timer(&sess->timer, &timeout); 1273 1274 if (forced) { 1275 release_stun_session(sess); 1276 } else { 1277 /* Schedule session clean up, it needs PJSUA lock and locking it here 1278 * may cause deadlock as this function may be called by STUN socket 1279 * while holding STUN socket lock, while application may wait for STUN 1280 * resolution while holding PJSUA lock. 1281 */ 1282 pj_timer_entry_init(&sess->timer, 0, (void*)sess, 1283 &destroy_stun_resolve_cb); 1284 pjsua_schedule_timer(&sess->timer, &timeout); 1285 } 1277 1286 } 1278 1287 … … 1289 1298 } 1290 1299 1291 destroy_stun_resolve(sess );1300 destroy_stun_resolve(sess, PJ_FALSE); 1292 1301 } 1293 1302 … … 1849 1858 } 1850 1859 1851 /* Terminate any pending STUN resolution */1852 if (!pj_list_empty(&pjsua_var.stun_res)) {1853 pjsua_stun_resolve *sess = pjsua_var.stun_res.next;1854 while (sess != &pjsua_var.stun_res) {1855 pjsua_stun_resolve *next = sess->next;1856 destroy_stun_resolve(sess);1857 sess = next;1858 }1859 }1860 1861 1860 /* Wait until all unregistrations are done (ticket #364) */ 1862 1861 /* First stage, get the maximum wait time */ … … 1899 1898 1900 1899 PJ_LOG(4,(THIS_FILE, "Destroying...")); 1900 1901 /* Terminate any pending STUN resolution */ 1902 if (!pj_list_empty(&pjsua_var.stun_res)) { 1903 pjsua_stun_resolve *sess = pjsua_var.stun_res.next; 1904 while (sess != &pjsua_var.stun_res) { 1905 pjsua_stun_resolve *next = sess->next; 1906 destroy_stun_resolve(sess, PJ_TRUE); 1907 sess = next; 1908 } 1909 } 1901 1910 1902 1911 /* Destroy media (to shutdown media endpoint, etc) */
Note: See TracChangeset
for help on using the changeset viewer.