- Timestamp:
- Oct 13, 2009 2:01:59 PM (15 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r2940 r2942 1752 1752 1753 1753 /** 1754 * Maximum time to wait for unpublication transaction(s) to complete 1755 * during shutdown process, before sending unregistration. The library 1756 * tries to wait for the unpublication (un-PUBLISH) to complete before 1757 * sending REGISTER request to unregister the account, during library 1758 * shutdown process. If the value is set too short, it is possible that 1759 * the unregistration is sent before unpublication completes, causing 1760 * unpublication request to fail. 1761 * 1762 * Default: 2000 (2 seconds) 1763 */ 1764 #ifndef PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC 1765 # define PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC 2000 1766 #endif 1767 1768 1769 /** 1754 1770 * This structure describes account configuration to be specified when 1755 1771 * adding a new account with #pjsua_acc_add(). Application MUST initialize … … 1801 1817 */ 1802 1818 pjsip_publishc_opt publish_opt; 1819 1820 /** 1821 * Maximum time to wait for unpublication transaction(s) to complete 1822 * during shutdown process, before sending unregistration. The library 1823 * tries to wait for the unpublication (un-PUBLISH) to complete before 1824 * sending REGISTER request to unregister the account, during library 1825 * shutdown process. If the value is set too short, it is possible that 1826 * the unregistration is sent before unpublication completes, causing 1827 * unpublication request to fail. 1828 * 1829 * Default: PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC 1830 */ 1831 unsigned unpublish_max_wait_time_msec; 1803 1832 1804 1833 /** -
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 */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r2940 r2942 993 993 994 994 } else { 995 if (param->expiration == -1) {995 if (param->expiration < 1) { 996 996 /* Could happen if server "forgot" to include Expires header 997 997 * in the response. We will not renew, so destroy the pubc. … … 1202 1202 acc->online_status = PJ_FALSE; 1203 1203 send_publish(acc_id, PJ_FALSE); 1204 /* By ticket #364, don't destroy the session yet (let the callback 1205 destroy it) 1204 1206 if (acc->publish_sess) { 1205 1207 pjsip_publishc_destroy(acc->publish_sess); 1206 1208 acc->publish_sess = NULL; 1207 1209 } 1210 */ 1208 1211 acc_cfg->publish_enabled = PJ_FALSE; 1209 1212 }
Note: See TracChangeset
for help on using the changeset viewer.