Changeset 5521 for pjproject


Ignore:
Timestamp:
Jan 11, 2017 7:29:46 AM (7 years ago)
Author:
nanang
Message:

Fixed #1990:

  • Added check for possibility of premature failure in pj_turn_sock_alloc() after pj_turn_session_set_server() returns PJ_SUCCESS.
  • Added more logs on ICE initialization progress for future debugging.
Location:
pjproject/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c

    r5520 r5521  
    18371837    tp_ice = (struct transport_ice*) pj_ice_strans_get_user_data(ice_st); 
    18381838 
     1839    pj_perror(5, tp_ice->base.name, result, "ICE operation complete" 
     1840              " (op=%d%s)", op, 
     1841              (op==PJ_ICE_STRANS_OP_INIT? "/initialization" : 
     1842              (op==PJ_ICE_STRANS_OP_NEGOTIATION? "/negotiation":""))); 
     1843 
    18391844    /* Notify application */ 
    18401845    if (tp_ice->cb.on_ice_complete) 
  • pjproject/trunk/pjnath/src/pjnath/ice_strans.c

    r5481 r5521  
    377377        cand->status = PJ_EPENDING; 
    378378        cand->local_pref = RELAY_PREF; 
    379         cand->transport_id = CREATE_TP_ID(TP_TURN, idx); 
     379        cand->transport_id = tp_id; 
    380380        cand->comp_id = (pj_uint8_t) comp->comp_id; 
    381381    } 
     
    414414 
    415415    PJ_LOG(4,(ice_st->obj_name, 
    416                   "Comp %d: TURN relay candidate waiting for allocation", 
    417                   comp->comp_id)); 
     416                  "Comp %d/%d: TURN relay candidate (tpid=%d) " 
     417                  "waiting for allocation", 
     418                  comp->comp_id, comp->cand_cnt-1, cand->transport_id)); 
    418419 
    419420    return PJ_SUCCESS; 
     
    516517 
    517518        PJ_LOG(4,(ice_st->obj_name, 
    518                   "Comp %d: srflx candidate starts Binding discovery", 
    519                   comp->comp_id)); 
     519                  "Comp %d: srflx candidate (tpid=%d) starts " 
     520                  "Binding discovery", 
     521                  comp->comp_id, cand->transport_id)); 
    520522 
    521523        pj_log_push_indent(); 
     
    623625            if (cand_duplicate) { 
    624626                PJ_LOG(4, (ice_st->obj_name, 
    625                        "Comp %d: host candidate %s is a duplicate", 
     627                       "Comp %d: host candidate %s (tpid=%d) is a duplicate", 
    626628                       comp->comp_id, pj_sockaddr_print(&cand->addr, addrinfo, 
    627                        sizeof(addrinfo), 3))); 
     629                       sizeof(addrinfo), 3), cand->transport_id)); 
    628630 
    629631                pj_bzero(&cand->addr, sizeof(cand->addr)); 
     
    638640 
    639641            PJ_LOG(4,(ice_st->obj_name, 
    640                       "Comp %d: host candidate %s added", 
    641                       comp->comp_id, pj_sockaddr_print(&cand->addr, addrinfo, 
    642                                                       sizeof(addrinfo), 3))); 
     642                      "Comp %d/%d: host candidate %s (tpid=%d) added", 
     643                      comp->comp_id, comp->cand_cnt-1,  
     644                      pj_sockaddr_print(&cand->addr, addrinfo, 
     645                                        sizeof(addrinfo), 3), 
     646                                        cand->transport_id)); 
    643647        } 
    644648    } 
     
    941945         * have not been created. 
    942946         */ 
    943         if (!comp || comp->creating) return; 
     947        if (!comp || comp->creating) { 
     948            PJ_LOG(5, (ice_st->obj_name, "ICE init update: creating comp %d", 
     949                       (comp?comp->comp_id:(i+1)) )); 
     950            return; 
     951        } 
    944952 
    945953        for (j=0; j<comp->cand_cnt; ++j) { 
    946954            pj_ice_sess_cand *cand = &comp->cand_list[j]; 
    947955 
    948             if (cand->status == PJ_EPENDING) 
     956            if (cand->status == PJ_EPENDING) { 
     957                PJ_LOG(5, (ice_st->obj_name, "ICE init update: " 
     958                           "comp %d/%d[%s] is pending", 
     959                           comp->comp_id, j, 
     960                           pj_ice_get_cand_type_name(cand->type))); 
    949961                return; 
     962            } 
    950963        } 
    951964    } 
     
    19571970        char ipaddr[PJ_INET6_ADDRSTRLEN+8]; 
    19581971        pj_ice_sess_cand *cand = NULL; 
    1959         unsigned i; 
     1972        unsigned i, cand_idx = 0xFF; 
    19601973 
    19611974        comp->turn[tp_idx].err_cnt = 0; 
     
    19731986            { 
    19741987                cand = &comp->cand_list[i]; 
     1988                cand_idx = i; 
    19751989                break; 
    19761990            } 
     
    20082022 
    20092023        PJ_LOG(4,(comp->ice_st->obj_name, 
    2010                   "Comp %d: TURN allocation complete, relay address is %s", 
    2011                   comp->comp_id, 
     2024                  "Comp %d/%d: TURN allocation (tpid=%d) complete, " 
     2025                  "relay address is %s", 
     2026                  comp->comp_id, cand_idx, cand->transport_id, 
    20122027                  pj_sockaddr_print(&rel_info.relay_addr, ipaddr, 
    20132028                                     sizeof(ipaddr), 3))); 
     
    20202035    { 
    20212036        pj_ice_sess_cand *cand = NULL; 
    2022         unsigned i; 
     2037        unsigned i, cand_idx = 0xFF; 
    20232038 
    20242039        /* DNS resolution or TURN transport creation/allocation 
     
    20402055            { 
    20412056                cand = &comp->cand_list[i]; 
     2057                cand_idx = i; 
    20422058                break; 
    20432059            } 
     
    20502066         * to the list. 
    20512067         */ 
    2052         if (cand) cand->status = PJ_ERESOLVE; 
     2068        if (cand) { 
     2069            cand->status = PJ_ERESOLVE; 
     2070            PJ_LOG(4,(comp->ice_st->obj_name, 
     2071                      "Comp %d/%d: TURN resolving (tpid=%d) failed", 
     2072                      comp->comp_id, cand_idx, cand->transport_id)); 
     2073        } 
    20532074 
    20542075        sess_init_update(comp->ice_st); 
  • pjproject/trunk/pjnath/src/pjnath/turn_sock.c

    r5474 r5521  
    429429        pj_grp_lock_release(turn_sock->grp_lock); 
    430430        return status; 
     431    } else if (!turn_sock->sess) { 
     432        /* TURN session may have been destroyed here, i.e: when DNS resolution 
     433         * completed synchronously and TURN allocation failed. 
     434         */ 
     435        PJ_LOG(4,(turn_sock->obj_name, "TURN session destroyed in setting " 
     436                                       "TURN server")); 
     437        pj_grp_lock_release(turn_sock->grp_lock); 
     438        return PJ_EGONE; 
    431439    } 
    432440 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r5510 r5521  
    17421742        call->med_ch_mutex = NULL; 
    17431743    } 
     1744 
     1745    PJ_PERROR(5,(THIS_FILE, status, 
     1746                 "Call %d: media transport initialization complete", call_id)); 
    17441747 
    17451748    if (status != PJ_SUCCESS) { 
Note: See TracChangeset for help on using the changeset viewer.