Changeset 5307
- Timestamp:
- May 19, 2016 4:30:05 AM (9 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r5297 r5307 2049 2049 pj_sockaddr addr; 2050 2050 2051 /** 2052 * The index of the usable STUN server. 2053 */ 2054 unsigned index; 2051 2055 }; 2052 2056 -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r5288 r5307 436 436 pj_status_t stun_status; /**< STUN server status. */ 437 437 pjsua_stun_resolve stun_res; /**< List of pending STUN resolution*/ 438 pj_dns_resolver *resolver; /**< DNS resolver. */ 438 unsigned stun_srv_idx; /**< Resolved STUN server index */ 439 pj_dns_resolver *resolver; /**< DNS resolver. */ 439 440 440 441 /* Detected NAT type */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r5297 r5307 1206 1206 result.status = sess->status; 1207 1207 result.name = sess->srv[sess->idx]; 1208 result.index = sess->idx; 1208 1209 pj_memcpy(&result.addr, &sess->addr, sizeof(result.addr)); 1209 1210 sess->has_result = PJ_TRUE; … … 1509 1510 if ((result->status == PJ_SUCCESS) && (pjsua_var.ua_cfg.stun_srv_cnt>0)) { 1510 1511 pj_memcpy(&pjsua_var.stun_srv, &result->addr, sizeof(result->addr)); 1512 pjsua_var.stun_srv_idx = result->index; 1511 1513 1512 1514 /* Perform NAT type detection if not yet */ … … 1555 1557 */ 1556 1558 if (wait) { 1557 while (pjsua_var.stun_status == PJ_EPENDING) { 1559 pj_bool_t has_pjsua_lock = PJSUA_LOCK_IS_LOCKED(); 1560 1561 if (has_pjsua_lock) 1562 PJSUA_UNLOCK(); 1563 1564 while (pjsua_var.stun_status == PJ_EPENDING) { 1558 1565 /* If there is no worker thread or 1559 1566 * the function is called from the only worker thread, … … 1569 1576 } 1570 1577 } 1578 if (has_pjsua_lock) 1579 PJSUA_LOCK(); 1571 1580 } 1572 1581 } -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5297 r5307 394 394 ((acc->cfg.media_stun_use & PJSUA_STUN_RETRY_ON_FAILURE)!=0)) 395 395 { 396 PJ_LOG(4,(THIS_FILE, "Failed to get STUN mapped address, " 397 "retrying other STUN servers")); 396 pj_str_t srv = 397 pjsua_var.ua_cfg.stun_srv[pjsua_var.stun_srv_idx]; 398 399 PJ_LOG(4,(THIS_FILE, "Failed to get STUN mapped address, " 400 "retrying other STUN servers")); 401 402 if (pjsua_var.stun_srv_idx < pjsua_var.ua_cfg.stun_srv_cnt-1) { 403 PJSUA_LOCK(); 404 /* Move the unusable STUN server to the last position 405 * as the least prioritize. 406 */ 407 pj_array_erase(pjsua_var.ua_cfg.stun_srv, 408 sizeof(pj_str_t), 409 pjsua_var.ua_cfg.stun_srv_cnt, 410 pjsua_var.stun_srv_idx); 411 412 pj_array_insert(pjsua_var.ua_cfg.stun_srv, 413 sizeof(pj_str_t), 414 pjsua_var.ua_cfg.stun_srv_cnt-1, 415 pjsua_var.ua_cfg.stun_srv_cnt-1, 416 &srv); 417 418 PJSUA_UNLOCK(); 419 } 398 420 status=pjsua_update_stun_servers(pjsua_var.ua_cfg.stun_srv_cnt, 399 421 pjsua_var.ua_cfg.stun_srv, 400 PJ_TRUE); 422 PJ_FALSE); 423 424 if (status == PJ_SUCCESS) 425 status = resolve_stun_server(PJ_TRUE); 426 401 427 if (status == PJ_SUCCESS) { 402 428 if (pjsua_var.stun_srv.addr.sa_family != 0) {
Note: See TracChangeset
for help on using the changeset viewer.