Changeset 5861 for pjproject/trunk/pjnath/src/pjnath/ice_strans.c
- Timestamp:
- Aug 16, 2018 2:56:52 AM (6 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.