Changeset 5861
- Timestamp:
- Aug 16, 2018 2:56:52 AM (6 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r5833 r5861 518 518 return status; 519 519 520 /* Start STUN Binding resolution and add srflx candidate 521 * only if server is set 520 /* Start STUN Binding resolution and add srflx candidate only if server 521 * is set. When any error occur during STUN Binding resolution, let's 522 * just skip it and generate host candidates. 522 523 */ 523 if(stun_cfg->server.slen) {524 while (stun_cfg->server.slen) { 524 525 pj_stun_sock_info stun_sock_info; 525 526 … … 539 540 if (status != PJ_SUCCESS) { 540 541 ///sess_dec_ref(ice_st); 542 PJ_PERROR(5,(ice_st->obj_name, status, 543 "Comp %d: srflx candidate (tpid=%d) failed in " 544 "pj_stun_sock_start()", 545 comp->comp_id, cand->transport_id)); 541 546 pj_log_pop_indent(); 542 return status;547 break; 543 548 } 544 549 … … 547 552 if (status != PJ_SUCCESS) { 548 553 ///sess_dec_ref(ice_st); 554 PJ_PERROR(5,(ice_st->obj_name, status, 555 "Comp %d: srflx candidate (tpid=%d) failed in " 556 "pj_stun_sock_get_info()", 557 comp->comp_id, cand->transport_id)); 549 558 pj_log_pop_indent(); 550 return status;559 break; 551 560 } 552 561 … … 568 577 569 578 pj_log_pop_indent(); 579 580 /* Not really a loop, just trying to avoid complex 'if' blocks */ 581 break; 570 582 } 571 583 … … 575 587 if (stun_cfg->max_host_cands) { 576 588 pj_stun_sock_info stun_sock_info; 577 unsigned i ;589 unsigned i, cand_cnt = 0; 578 590 579 591 /* Enumerate addresses */ 580 592 status = pj_stun_sock_get_info(comp->stun[idx].sock, &stun_sock_info); 581 if (status != PJ_SUCCESS) 593 if (status != PJ_SUCCESS) { 594 PJ_PERROR(4,(ice_st->obj_name, status, 595 "Failed in querying STUN socket info")); 582 596 return status; 583 584 for (i=0; i<stun_sock_info.alias_cnt && 585 i<stun_cfg->max_host_cands; ++i) 597 } 598 599 for (i = 0; i < stun_sock_info.alias_cnt && 600 cand_cnt < stun_cfg->max_host_cands; ++i) 586 601 { 587 602 unsigned j; … … 614 629 } 615 630 616 /* Ignore IPv6 link-local address */ 617 if (stun_cfg->af == pj_AF_INET6()) { 631 /* Ignore IPv6 link-local address, unless it is the default 632 * address (first alias). 633 */ 634 if (stun_cfg->af == pj_AF_INET6() && i != 0) { 618 635 const pj_in6_addr *a = &addr->ipv6.sin6_addr; 619 636 if (a->s6_addr[0] == 0xFE && (a->s6_addr[1] & 0xC0) == 0x80) … … 651 668 } else { 652 669 comp->cand_cnt+=1; 670 cand_cnt++; 653 671 } 654 672 … … 676 694 } 677 695 678 return PJ_SUCCESS;696 return status; 679 697 } 680 698 -
pjproject/trunk/pjnath/src/pjnath/stun_sock.c
r5678 r5861 427 427 stun_sock, &dns_srv_resolver_cb, 428 428 &stun_sock->q); 429 if (status != PJ_SUCCESS) { 430 PJ_PERROR(4,(stun_sock->obj_name, status, 431 "Failed in pj_dns_srv_resolve()")); 432 } 429 433 430 434 /* Processing will resume when the DNS SRV callback is called */ … … 441 445 442 446 if (status != PJ_SUCCESS) { 447 PJ_PERROR(4,(stun_sock->obj_name, status, 448 "Failed in pj_getaddrinfo()")); 443 449 pj_grp_lock_release(stun_sock->grp_lock); 444 450 return status; … … 452 458 /* Start sending Binding request */ 453 459 status = get_mapped_addr(stun_sock); 460 if (status != PJ_SUCCESS) { 461 PJ_PERROR(4,(stun_sock->obj_name, status, 462 "Failed in sending Binding request")); 463 } 454 464 } 455 465 … … 667 677 status = pj_gethostip(stun_sock->af, &def_addr); 668 678 if (status != PJ_SUCCESS) { 679 PJ_PERROR(4,(stun_sock->obj_name, status, 680 "Failed in getting default address for STUN info")); 669 681 pj_grp_lock_release(stun_sock->grp_lock); 670 682 return status; … … 678 690 info->aliases); 679 691 if (status != PJ_SUCCESS) { 680 pj_grp_lock_release(stun_sock->grp_lock); 681 return status; 692 /* If enumeration fails, just return the default address */ 693 PJ_PERROR(4,(stun_sock->obj_name, status, 694 "Failed in enumerating interfaces for STUN info, " 695 "returning default address only")); 696 info->alias_cnt = 1; 697 pj_sockaddr_cp(&info->aliases[0], &def_addr); 682 698 } 683 699 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5843 r5861 928 928 929 929 /* Configure STUN server */ 930 if (pj_sockaddr_has_addr(&pjsua_var.stun_srv) && 931 pjsua_media_acc_is_using_stun(call_med->call->acc_id)) 930 if (pjsua_media_acc_is_using_stun(call_med->call->acc_id) && 931 pj_sockaddr_has_addr(&pjsua_var.stun_srv) && 932 pjsua_var.stun_srv.addr.sa_family == ice_cfg.stun_tp[i].af) 932 933 { 933 934 ice_cfg.stun_tp[i].server = pj_str(stunip);
Note: See TracChangeset
for help on using the changeset viewer.