Changeset 3829 for pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_core.c
- Timestamp:
- Oct 19, 2011 12:45:05 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_core.c
r3594 r3829 1284 1284 * Destroy pjsua. 1285 1285 */ 1286 PJ_DEF(pj_status_t) pjsua_destroy (void)1286 PJ_DEF(pj_status_t) pjsua_destroy2(unsigned flags) 1287 1287 { 1288 1288 int i; /* Must be signed */ … … 1303 1303 unsigned max_wait; 1304 1304 1305 PJ_LOG(4,(THIS_FILE, "Shutting down ..."));1305 PJ_LOG(4,(THIS_FILE, "Shutting down, flags=%d...", flags)); 1306 1306 1307 1307 /* Terminate all calls. */ 1308 pjsua_call_hangup_all(); 1308 if ((flags & PJSUA_DESTROY_NO_NETWORK) == 0) { 1309 pjsua_call_hangup_all(); 1310 } 1309 1311 1310 1312 /* Set all accounts to offline */ … … 1317 1319 1318 1320 /* Terminate all presence subscriptions. */ 1319 pjsua_pres_shutdown( );1321 pjsua_pres_shutdown(flags); 1320 1322 1321 1323 /* Destroy media (to shutdown media transports etc) */ 1322 pjsua_media_subsys_destroy( );1324 pjsua_media_subsys_destroy(flags); 1323 1325 1324 1326 /* Wait for sometime until all publish client sessions are done … … 1334 1336 } 1335 1337 1338 /* No need to wait if we didn't send anything */ 1339 if (flags & PJSUA_DESTROY_NO_NETWORK) { 1340 max_wait = 0; 1341 } 1342 1336 1343 /* Second stage, wait for unpublications to complete */ 1337 1344 for (i=0; i<(int)(max_wait/50); ++i) { … … 1363 1370 continue; 1364 1371 1365 if (pjsua_var.acc[i].regc) { 1372 if (pjsua_var.acc[i].regc && (flags & PJSUA_DESTROY_NO_NETWORK)==0) 1373 { 1366 1374 pjsua_acc_set_registration(i, PJ_FALSE); 1367 1375 } … … 1388 1396 } 1389 1397 1398 /* No need to wait if we didn't send anything */ 1399 if (flags & PJSUA_DESTROY_NO_NETWORK) { 1400 max_wait = 0; 1401 } 1402 1390 1403 /* Second stage, wait for unregistrations to complete */ 1391 1404 for (i=0; i<(int)(max_wait/50); ++i) { … … 1408 1421 * transports shutdown to complete: 1409 1422 */ 1410 if (i < 20 )1423 if (i < 20 && (flags & PJSUA_DESTROY_NO_NETWORK) == 0) { 1411 1424 busy_sleep(1000 - i*50); 1425 } 1412 1426 1413 1427 PJ_LOG(4,(THIS_FILE, "Destroying...")); … … 1467 1481 /* Done. */ 1468 1482 return PJ_SUCCESS; 1483 } 1484 1485 1486 PJ_DEF(pj_status_t) pjsua_destroy(void) 1487 { 1488 return pjsua_destroy2(0); 1469 1489 } 1470 1490
Note: See TracChangeset
for help on using the changeset viewer.