Changeset 4038


Ignore:
Timestamp:
Apr 11, 2012 10:01:00 AM (12 years ago)
Author:
bennylp
Message:

Re #1474: merged r4031-r4037

Location:
pjproject/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk

  • pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h

    r3553 r4038  
    266266                                              const pjsip_tpselector *sel); 
    267267 
     268/** 
     269 * Release the reference to current transport being used by the regc, if any. 
     270 * The regc keeps the reference to the last transport being used in order 
     271 * to prevent it from being destroyed. In some situation however, such as 
     272 * when the transport is disconnected, it is necessary to instruct the 
     273 * regc to release this reference so that the transport can be destroyed. 
     274 * See https://trac.pjsip.org/repos/ticket/1481 for background info. 
     275 * 
     276 * @param regc      The client registration instance. 
     277 * 
     278 * @return          PJ_SUCCESS on success, or the appropriate error code. 
     279 */ 
     280PJ_DECL(pj_status_t) pjsip_regc_release_transport(pjsip_regc *regc); 
    268281 
    269282/** 
  • pjproject/trunk/pjsip/include/pjsip/sip_config.h

    r3999 r4038  
    428428 
    429429/** 
    430  * Idle timeout interval to be applied to transports with no usage 
    431  * before the transport is destroyed. Value is in seconds. 
     430 * Idle timeout interval to be applied to outgoing transports (i.e. client 
     431 * side) with no usage before the transport is destroyed. Value is in 
     432 * seconds. 
    432433 * 
    433434 * Default: 30 
     
    435436#ifndef PJSIP_TRANSPORT_IDLE_TIME 
    436437#   define PJSIP_TRANSPORT_IDLE_TIME    30 
     438#endif 
     439 
     440 
     441/** 
     442 * Idle timeout interval to be applied to incoming transports (i.e. server 
     443 * side) with no usage before the transport is destroyed. Server typically 
     444 * should let client close the connection, hence set this interval to a large 
     445 * value. Value is in seconds. 
     446 * 
     447 * Default: 600 
     448 */ 
     449#ifndef PJSIP_TRANSPORT_SERVER_IDLE_TIME 
     450#   define PJSIP_TRANSPORT_SERVER_IDLE_TIME     600 
    437451#endif 
    438452 
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c

    r3553 r4038  
    441441} 
    442442 
     443/* Release transport */ 
     444PJ_DEF(pj_status_t) pjsip_regc_release_transport(pjsip_regc *regc) 
     445{ 
     446    PJ_ASSERT_RETURN(regc, PJ_EINVAL); 
     447    if (regc->last_transport) { 
     448        pjsip_transport_dec_ref(regc->last_transport); 
     449        regc->last_transport = NULL; 
     450    } 
     451    return PJ_SUCCESS; 
     452} 
     453 
    443454 
    444455PJ_DEF(pj_status_t) pjsip_regc_add_headers( pjsip_regc *regc, 
     
    12701281 
    12711282    /* Get last transport used and add reference to it */ 
    1272     if (tdata->tp_info.transport != regc->last_transport) { 
     1283    if (tdata->tp_info.transport != regc->last_transport && 
     1284        status==PJ_SUCCESS) 
     1285    { 
    12731286        if (regc->last_transport) { 
    12741287            pjsip_transport_dec_ref(regc->last_transport); 
  • pjproject/trunk/pjsip/src/pjsip/sip_transport.c

    r3553 r4038  
    858858                delay.sec = delay.msec = 0; 
    859859            } else { 
    860                 delay.sec = PJSIP_TRANSPORT_IDLE_TIME; 
     860                delay.sec = (tp->dir==PJSIP_TP_DIR_OUTGOING) ? 
     861                                PJSIP_TRANSPORT_IDLE_TIME : 
     862                                PJSIP_TRANSPORT_SERVER_IDLE_TIME; 
    861863                delay.msec = 0; 
    862864            } 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c

    r3891 r4038  
    28832883        } 
    28842884 
     2885        /* Release regc transport immediately 
     2886         * See https://trac.pjsip.org/repos/ticket/1481 
     2887         */ 
     2888        if (pjsua_var.acc[i].regc) { 
     2889            pjsip_regc_release_transport(pjsua_var.acc[i].regc); 
     2890        } 
     2891 
    28852892        /* Schedule reregistration for this account */ 
    28862893        schedule_reregistration(acc); 
Note: See TracChangeset for help on using the changeset viewer.