Changeset 1207


Ignore:
Timestamp:
Apr 19, 2007 11:03:23 AM (17 years ago)
Author:
bennylp
Message:

ICE: check for duplicate candidates, and change foundation to use the base address instead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath/ice_strans.c

    r1154 r1207  
    213213{ 
    214214    pj_ice_strans_cand *cand; 
     215    unsigned i; 
    215216 
    216217    PJ_ASSERT_RETURN(ice_st && comp && addr, PJ_EINVAL); 
    217218    PJ_ASSERT_RETURN(comp->cand_cnt < PJ_ICE_ST_MAX_CAND, PJ_ETOOMANY); 
     219 
     220    /* Check that we don't have candidate with the same 
     221     * address. 
     222     */ 
     223    for (i=0; i<comp->cand_cnt; ++i) { 
     224        if (pj_memcmp(addr, &comp->cand_list[i].addr,  
     225                      sizeof(pj_sockaddr_in))==0) 
     226        { 
     227            /* Duplicate */ 
     228            PJ_LOG(5,(ice_st->obj_name, "Duplicate candidate not added")); 
     229            return PJ_SUCCESS; 
     230        } 
     231    } 
    218232 
    219233    cand = &comp->cand_list[comp->cand_cnt]; 
     
    226240    cand->local_pref = local_pref; 
    227241    pj_ice_calc_foundation(ice_st->pool, &cand->foundation, type,  
    228                            (const pj_sockaddr*)addr); 
     242                           &comp->local_addr); 
    229243 
    230244    if (set_default)  
Note: See TracChangeset for help on using the changeset viewer.