Changeset 6072 for pjproject


Ignore:
Timestamp:
Sep 23, 2019 7:27:53 AM (5 years ago)
Author:
ming
Message:

Re #2218: ICE initialization issue if an error happens during allocating state

File:
1 edited

Legend:

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

    r6071 r6072  
    10741074{ 
    10751075    unsigned i; 
     1076    pj_status_t status = PJ_EUNKNOWN; 
    10761077 
    10771078    /* Ignore if ICE is destroying or init callback has been called */ 
     
    10931094        } 
    10941095 
     1096        status = PJ_EUNKNOWN; 
    10951097        for (j=0; j<comp->cand_cnt; ++j) { 
    10961098            pj_ice_sess_cand *cand = &comp->cand_list[j]; 
     
    11031105                return; 
    11041106            } 
    1105         } 
    1106     } 
    1107  
    1108     /* All candidates have been gathered */ 
     1107             
     1108            if (status == PJ_EUNKNOWN) { 
     1109                status = cand->status; 
     1110            } else { 
     1111                /* We only need one successful candidate. */ 
     1112                if (cand->status == PJ_SUCCESS) 
     1113                    status = PJ_SUCCESS; 
     1114            } 
     1115        } 
     1116         
     1117        if (status != PJ_SUCCESS) 
     1118            break; 
     1119    } 
     1120 
     1121    /* All candidates have been gathered or there's no successful 
     1122     * candidate for a component. 
     1123     */ 
    11091124    ice_st->cb_called = PJ_TRUE; 
    11101125    ice_st->state = PJ_ICE_STRANS_STATE_READY; 
    11111126    if (ice_st->cb.on_ice_complete) 
    11121127        (*ice_st->cb.on_ice_complete)(ice_st, PJ_ICE_STRANS_OP_INIT, 
    1113                                       PJ_SUCCESS); 
     1128                                      status); 
    11141129} 
    11151130 
     
    25042519         */ 
    25052520        if (cand) { 
     2521            pj_turn_session_info info; 
     2522 
     2523            pj_turn_sock_get_info(turn_sock, &info); 
    25062524            cand->status = (old_state == PJ_TURN_STATE_RESOLVING)? 
    2507                            PJ_ERESOLVE : PJ_EINVALIDOP; 
     2525                           PJ_ERESOLVE : info.last_status; 
    25082526            PJ_LOG(4,(comp->ice_st->obj_name, 
    25092527                      "Comp %d/%d: TURN error (tpid=%d) during state %s", 
Note: See TracChangeset for help on using the changeset viewer.