Changeset 4133


Ignore:
Timestamp:
May 21, 2012 2:00:17 PM (12 years ago)
Author:
bennylp
Message:

Fixed #1512: added Option to continue ICE operation even when STUN resolution fails

Location:
pjproject/trunk/pjnath
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath/ice_strans.h

    r3553 r4133  
    270270        pj_uint16_t          port; 
    271271 
     272        /** 
     273         * Ignore STUN resolution error and proceed with just local 
     274         * addresses. 
     275         * 
     276         * The default is PJ_FALSE 
     277         */ 
     278        pj_bool_t            ignore_stun_error; 
     279 
    272280    } stun; 
    273281 
  • pjproject/trunk/pjnath/src/pjnath/ice_strans.c

    r3999 r4133  
    222222 
    223223    cfg->stun.max_host_cands = 64; 
     224    cfg->stun.ignore_stun_error = PJ_FALSE; 
    224225} 
    225226 
     
    15021503            if (cand) 
    15031504                cand->status = status; 
    1504             sess_fail(ice_st, PJ_ICE_STRANS_OP_INIT, "DNS resolution failed",  
    1505                       status); 
     1505            if (!ice_st->cfg.stun.ignore_stun_error) { 
     1506                sess_fail(ice_st, PJ_ICE_STRANS_OP_INIT, 
     1507                          "DNS resolution failed", status); 
     1508            } else { 
     1509                PJ_LOG(4,(ice_st->obj_name, 
     1510                          "STUN error is ignored for comp %d", 
     1511                          comp->comp_id)); 
     1512            } 
    15061513        } 
    15071514        break; 
     
    15401547                        --comp->default_cand; 
    15411548                    } else if (comp->default_cand == idx) { 
    1542                         comp->default_cand = 0; 
     1549                        comp->default_cand = !idx; 
    15431550                    } 
    15441551 
     
    15681575            if (cand) 
    15691576                cand->status = status; 
    1570             sess_fail(ice_st, PJ_ICE_STRANS_OP_INIT,  
    1571                       "STUN binding request failed", status); 
     1577            if (!ice_st->cfg.stun.ignore_stun_error) { 
     1578                sess_fail(ice_st, PJ_ICE_STRANS_OP_INIT, 
     1579                          "STUN binding request failed", status); 
     1580            } else { 
     1581                PJ_LOG(4,(ice_st->obj_name, 
     1582                          "STUN error is ignored for comp %d", 
     1583                          comp->comp_id)); 
     1584 
     1585                if (cand) { 
     1586                    unsigned idx = cand - comp->cand_list; 
     1587 
     1588                    /* Update default candidate index */ 
     1589                    if (comp->default_cand == idx) { 
     1590                        comp->default_cand = !idx; 
     1591                    } 
     1592                } 
     1593 
     1594                sess_init_update(ice_st); 
     1595            } 
    15721596        } 
    15731597        break; 
     
    15761600            pj_assert(cand != NULL); 
    15771601            cand->status = status; 
    1578             sess_fail(ice_st, PJ_ICE_STRANS_OP_INIT,  
    1579                       "STUN keep-alive failed", status); 
     1602            if (!ice_st->cfg.stun.ignore_stun_error) { 
     1603                sess_fail(ice_st, PJ_ICE_STRANS_OP_INIT, 
     1604                          "STUN keep-alive failed", status); 
     1605            } else { 
     1606                PJ_LOG(4,(ice_st->obj_name, "STUN error is ignored")); 
     1607            } 
    15801608        } 
    15811609        break; 
Note: See TracChangeset for help on using the changeset viewer.