Ignore:
Timestamp:
Feb 19, 2013 2:37:28 PM (10 years ago)
Author:
ming
Message:

Fixed #1620: Fix the calculation of transmission count during retransmission of STUN request

File:
1 edited

Legend:

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

    r3753 r4352  
    181181 * Transmit message. 
    182182 */ 
    183 static pj_status_t tsx_transmit_msg(pj_stun_client_tsx *tsx) 
     183static pj_status_t tsx_transmit_msg(pj_stun_client_tsx *tsx, 
     184                                    pj_bool_t mod_count) 
    184185{ 
    185186    pj_status_t status; 
     
    188189                     !tsx->require_retransmit, PJ_EBUSY); 
    189190 
    190     if (tsx->require_retransmit) { 
     191    if (tsx->require_retransmit && mod_count) { 
    191192        /* Calculate retransmit/timeout delay */ 
    192193        if (tsx->transmit_count == 0) { 
     
    222223 
    223224 
    224     tsx->transmit_count++; 
     225    if (mod_count) 
     226        tsx->transmit_count++; 
    225227 
    226228    PJ_LOG(5,(tsx->obj_name, "STUN sending message (transmit count=%d)", 
     
    234236        /* We've been destroyed, don't access the object. */ 
    235237    } else if (status != PJ_SUCCESS) { 
    236         if (tsx->retransmit_timer.id != 0) { 
     238        if (tsx->retransmit_timer.id != 0 && mod_count) { 
    237239            pj_timer_heap_cancel(tsx->timer_heap,  
    238240                                 &tsx->retransmit_timer); 
     
    296298 
    297299    /* Send the message */ 
    298     status = tsx_transmit_msg(tsx); 
     300    status = tsx_transmit_msg(tsx, PJ_TRUE); 
    299301    if (status != PJ_SUCCESS) { 
    300302        if (tsx->retransmit_timer.id != 0) { 
     
    336338 
    337339    tsx->retransmit_timer.id = 0; 
    338     status = tsx_transmit_msg(tsx); 
     340    status = tsx_transmit_msg(tsx, PJ_TRUE); 
    339341    if (status == PJNATH_ESTUNDESTROYED) { 
    340342        /* We've been destroyed, don't try to access the object */ 
     
    354356 * Request to retransmit the request. 
    355357 */ 
    356 PJ_DEF(pj_status_t) pj_stun_client_tsx_retransmit(pj_stun_client_tsx *tsx) 
     358PJ_DEF(pj_status_t) pj_stun_client_tsx_retransmit(pj_stun_client_tsx *tsx, 
     359                                                  pj_bool_t mod_count) 
    357360{ 
    358361    if (tsx->destroy_timer.id != 0) { 
     
    365368    } 
    366369 
    367     return tsx_transmit_msg(tsx); 
     370    return tsx_transmit_msg(tsx, mod_count); 
    368371} 
    369372 
Note: See TracChangeset for help on using the changeset viewer.