Changeset 2942 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
- Timestamp:
- Oct 13, 2009 2:01:59 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r2940 r2942 163 163 cfg->reg_timeout = PJSUA_REG_INTERVAL; 164 164 pjsip_publishc_opt_default(&cfg->publish_opt); 165 cfg->unpublish_max_wait_time_msec = PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC; 165 166 cfg->transport_id = PJSUA_INVALID_ID; 166 167 cfg->allow_contact_rewrite = PJ_TRUE; … … 1229 1230 1230 1231 if (pjsua_var.endpt) { 1232 unsigned max_wait; 1233 1231 1234 /* Terminate all calls. */ 1232 1235 pjsua_call_hangup_all(); … … 1242 1245 /* Terminate all presence subscriptions. */ 1243 1246 pjsua_pres_shutdown(); 1247 1248 /* Wait for sometime until all publish client sessions are done 1249 * (ticket #364) 1250 */ 1251 /* First stage, get the maximum wait time */ 1252 max_wait = 100; 1253 for (i=0; i<PJ_ARRAY_SIZE(pjsua_var.acc); ++i) { 1254 if (!pjsua_var.acc[i].valid) 1255 continue; 1256 if (pjsua_var.acc[i].cfg.unpublish_max_wait_time_msec > max_wait) 1257 max_wait = pjsua_var.acc[i].cfg.unpublish_max_wait_time_msec; 1258 } 1259 1260 /* Second stage, wait for unpublications to complete */ 1261 for (i=0; i<(int)(max_wait/50); ++i) { 1262 unsigned j; 1263 for (j=0; j<PJ_ARRAY_SIZE(pjsua_var.acc); ++j) { 1264 if (!pjsua_var.acc[j].valid) 1265 continue; 1266 1267 if (pjsua_var.acc[j].publish_sess) 1268 break; 1269 } 1270 if (j != PJ_ARRAY_SIZE(pjsua_var.acc)) 1271 busy_sleep(50); 1272 else 1273 break; 1274 } 1275 1276 /* Third stage, forcefully destroy unfinished unpublications */ 1277 for (i=0; i<PJ_ARRAY_SIZE(pjsua_var.acc); ++i) { 1278 if (pjsua_var.acc[i].publish_sess) { 1279 pjsip_publishc_destroy(pjsua_var.acc[i].publish_sess); 1280 pjsua_var.acc[i].publish_sess = NULL; 1281 } 1282 } 1244 1283 1245 1284 /* Unregister all accounts */
Note: See TracChangeset
for help on using the changeset viewer.