Ignore:
Timestamp:
Aug 22, 2008 5:46:33 PM (13 years ago)
Author:
bennylp
Message:

Ticket #598: Update to draft-ietf-behave-rfc3489bis-18 and draft-ietf-behave-turn-09, and fix other things as well. Please see the ticket for more info

File:
1 edited

Legend:

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

    r1988 r2234  
    252252                                                unsigned pkt_len) 
    253253{ 
     254    pj_status_t status; 
     255 
    254256    PJ_ASSERT_RETURN(tsx && pkt && pkt_len, PJ_EINVAL); 
    255257    PJ_ASSERT_RETURN(tsx->retransmit_timer.id == 0, PJ_EBUSY); 
     
    262264    tsx->require_retransmit = retransmit; 
    263265 
     266    /* For TCP, schedule timeout timer after PJ_STUN_TIMEOUT_VALUE. 
     267     * Since we don't have timeout timer, simulate this by using 
     268     * retransmit timer. 
     269     */ 
     270    if (!retransmit) { 
     271        unsigned timeout; 
     272 
     273        pj_assert(tsx->retransmit_timer.id == 0); 
     274        tsx->transmit_count = PJ_STUN_MAX_TRANSMIT_COUNT; 
     275 
     276        timeout = tsx->rto_msec * 16; 
     277        tsx->retransmit_time.sec = timeout / 1000; 
     278        tsx->retransmit_time.msec = timeout % 1000; 
     279 
     280        /* Schedule timer first because when send_msg() failed we can 
     281         * cancel it (as opposed to when schedule_timer() failed we cannot 
     282         * cancel transmission). 
     283         */; 
     284        status = pj_timer_heap_schedule(tsx->timer_heap,  
     285                                        &tsx->retransmit_timer, 
     286                                        &tsx->retransmit_time); 
     287        if (status != PJ_SUCCESS) { 
     288            tsx->retransmit_timer.id = 0; 
     289            return status; 
     290        } 
     291    } 
     292 
    264293    /* Send the message */ 
    265     return tsx_transmit_msg(tsx); 
     294    status = tsx_transmit_msg(tsx); 
     295    if (status != PJ_SUCCESS) { 
     296        if (tsx->retransmit_timer.id != 0) { 
     297            pj_timer_heap_cancel(tsx->timer_heap,  
     298                                 &tsx->retransmit_timer); 
     299            tsx->retransmit_timer.id = 0; 
     300        } 
     301        return status; 
     302    } 
     303 
     304    return PJ_SUCCESS; 
    266305} 
    267306 
Note: See TracChangeset for help on using the changeset viewer.