- Timestamp:
- Feb 1, 2007 3:37:11 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r885 r923 1285 1285 pj_bool_t force ) 1286 1286 { 1287 pj_status_t status; 1288 1287 1289 /* Make sure id is in range. */ 1288 1290 PJ_ASSERT_RETURN(id>=0 && id<PJ_ARRAY_SIZE(pjsua_var.tpdata), PJ_EINVAL); … … 1297 1299 switch (pjsua_var.tpdata[id].type) { 1298 1300 case PJSIP_TRANSPORT_UDP: 1299 return pjsip_transport_destroy(pjsua_var.tpdata[id].data.tp); 1301 status = pjsip_transport_shutdown(pjsua_var.tpdata[id].data.tp); 1302 if (status != PJ_SUCCESS) 1303 return status; 1304 status = pjsip_transport_destroy(pjsua_var.tpdata[id].data.tp); 1305 if (status != PJ_SUCCESS) 1306 return status; 1307 break; 1308 1309 case PJSIP_TRANSPORT_TLS: 1300 1310 case PJSIP_TRANSPORT_TCP: 1311 /* This will close the TCP listener, but existing TCP/TLS 1312 * connections (if any) will still linger 1313 */ 1314 status = (*pjsua_var.tpdata[id].data.factory->destroy) 1315 (pjsua_var.tpdata[id].data.factory); 1316 if (status != PJ_SUCCESS) 1317 return status; 1318 1301 1319 break; 1320 1302 1321 default: 1303 break;1322 return PJ_EINVAL; 1304 1323 } 1305 1324 1306 1325 } else { 1326 /* If force is not specified, transports will be closed at their 1327 * convenient time. However this will leak PJSUA-API transport 1328 * descriptors as PJSUA-API wouldn't know when exactly the 1329 * transport is closed thus it can't cleanup PJSUA transport 1330 * descriptor. 1331 */ 1307 1332 switch (pjsua_var.tpdata[id].type) { 1308 1333 case PJSIP_TRANSPORT_UDP: 1309 1334 return pjsip_transport_shutdown(pjsua_var.tpdata[id].data.tp); 1335 case PJSIP_TRANSPORT_TLS: 1310 1336 case PJSIP_TRANSPORT_TCP: 1311 1337 return (*pjsua_var.tpdata[id].data.factory->destroy) 1312 1338 (pjsua_var.tpdata[id].data.factory); 1313 1339 default: 1314 break; 1315 } 1316 } 1317 1318 /* Unreachable */ 1319 pj_assert(!"Unknown transport"); 1320 return PJ_EINVALIDOP; 1340 return PJ_EINVAL; 1341 } 1342 } 1343 1344 /* Cleanup pjsua data when force is applied */ 1345 if (force) { 1346 pjsua_var.tpdata[id].type = PJSIP_TRANSPORT_UNSPECIFIED; 1347 pjsua_var.tpdata[id].data.ptr = NULL; 1348 } 1349 1350 return PJ_SUCCESS; 1321 1351 } 1322 1352
Note: See TracChangeset
for help on using the changeset viewer.