Ignore:
Timestamp:
May 19, 2016 6:55:16 AM (8 years ago)
Author:
ming
Message:

Fixed #1921: Add support to handle IPv6 transports in pjsua_transport API and transport keep alive

Also:

  • add more detailed transport info for TCP and TLS transport
  • fixed pjsua sample app which tries to get IPv4 local address from IPv6 transport.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r5307 r5308  
    24482448    PJSUA_LOCK(); 
    24492449 
    2450     if (t->type == PJSIP_TRANSPORT_UDP) { 
     2450    if ((t->type & PJSIP_TRANSPORT_UDP) == PJSIP_TRANSPORT_UDP) { 
    24512451 
    24522452        pjsip_transport *tp = t->data.tp; 
     
    24692469        status = PJ_SUCCESS; 
    24702470 
    2471     } else if (t->type == PJSIP_TRANSPORT_TCP || 
    2472                t->type == PJSIP_TRANSPORT_TLS) 
     2471    } else if ((t->type & PJSIP_TRANSPORT_TCP) == PJSIP_TRANSPORT_TCP || 
     2472               (t->type & PJSIP_TRANSPORT_TLS) == PJSIP_TRANSPORT_TLS) 
    24732473    { 
    24742474 
     
    24822482        info->id = id; 
    24832483        info->type = t->type; 
    2484         info->type_name = (t->type==PJSIP_TRANSPORT_TCP)? pj_str("TCP"): 
    2485                                                           pj_str("TLS"); 
    2486         info->info = (t->type==PJSIP_TRANSPORT_TCP)? pj_str("TCP transport"): 
    2487                                                      pj_str("TLS transport"); 
     2484        info->type_name = pj_str(factory->type_name); 
     2485        info->info = pj_str(factory->info); 
    24882486        info->flag = factory->flag; 
    24892487        info->addr_len = sizeof(factory->local_addr); 
     
    25352533{ 
    25362534    pj_status_t status; 
     2535    pjsip_transport_type_e tp_type; 
    25372536 
    25382537    /* Make sure id is in range. */ 
     
    25422541    /* Make sure that transport exists */ 
    25432542    PJ_ASSERT_RETURN(pjsua_var.tpdata[id].data.ptr != NULL, PJ_EINVAL); 
     2543 
     2544    tp_type = pjsua_var.tpdata[id].type & ~PJSIP_TRANSPORT_IPV6; 
    25442545 
    25452546    /* Note: destroy() may not work if there are objects still referencing 
     
    25472548     */ 
    25482549    if (force) { 
    2549         switch (pjsua_var.tpdata[id].type) { 
     2550        switch (tp_type) { 
    25502551        case PJSIP_TRANSPORT_UDP: 
    25512552            status = pjsip_transport_shutdown(pjsua_var.tpdata[id].data.tp); 
     
    25802581         * descriptor. 
    25812582         */ 
    2582         switch (pjsua_var.tpdata[id].type) { 
     2583        switch (tp_type) { 
    25832584        case PJSIP_TRANSPORT_UDP: 
    25842585            return pjsip_transport_shutdown(pjsua_var.tpdata[id].data.tp); 
Note: See TracChangeset for help on using the changeset viewer.