Changeset 5215
- Timestamp:
- Dec 16, 2015 3:58:09 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r5151 r5215 348 348 } 349 349 350 static pj_bool_t ice_cand_equals(pj_ice_sess_cand *lcand, 351 pj_ice_sess_cand *rcand) 352 { 353 if (lcand == NULL && rcand == NULL){ 354 return PJ_TRUE; 355 } 356 if (lcand == NULL || rcand == NULL){ 357 return PJ_FALSE; 358 } 359 360 if (lcand->type != rcand->type 361 || lcand->status != rcand->status 362 || lcand->comp_id != rcand->comp_id 363 || lcand->transport_id != rcand->transport_id 364 || lcand->local_pref != rcand->local_pref 365 || lcand->prio != rcand->prio 366 || pj_sockaddr_cmp(&lcand->addr, &rcand->addr) != 0 367 || pj_sockaddr_cmp(&lcand->base_addr, &rcand->base_addr) != 0) 368 { 369 return PJ_FALSE; 370 } 371 372 return PJ_TRUE; 373 } 350 374 351 375 /* … … 479 503 i<ice_st->cfg.stun.max_host_cands; ++i) 480 504 { 505 unsigned j; 506 pj_bool_t cand_duplicate = PJ_FALSE; 481 507 char addrinfo[PJ_INET6_ADDRSTRLEN+10]; 482 508 const pj_sockaddr *addr = &stun_sock_info.aliases[i]; … … 496 522 } 497 523 498 cand = &comp->cand_list[comp->cand_cnt ++];524 cand = &comp->cand_list[comp->cand_cnt]; 499 525 500 526 cand->type = PJ_ICE_CAND_TYPE_HOST; … … 506 532 pj_sockaddr_cp(&cand->base_addr, addr); 507 533 pj_bzero(&cand->rel_addr, sizeof(cand->rel_addr)); 534 535 /* Check if not already in list */ 536 for (j=0; j<comp->cand_cnt; j++) { 537 if (ice_cand_equals(cand, &comp->cand_list[j])) { 538 cand_duplicate = PJ_TRUE; 539 break; 540 } 541 } 542 543 if (cand_duplicate) { 544 PJ_LOG(4, (ice_st->obj_name, 545 "Comp %d: host candidate %s is a duplicate", 546 comp_id, pj_sockaddr_print(&cand->addr, addrinfo, 547 sizeof(addrinfo), 3))); 548 549 pj_bzero(&cand->addr, sizeof(cand->addr)); 550 pj_bzero(&cand->base_addr, sizeof(cand->base_addr)); 551 continue; 552 } else { 553 comp->cand_cnt+=1; 554 } 555 508 556 pj_ice_calc_foundation(ice_st->pool, &cand->foundation, 509 557 cand->type, &cand->base_addr);
Note: See TracChangeset
for help on using the changeset viewer.