Changeset 4567


Ignore:
Timestamp:
Jul 19, 2013 6:31:28 AM (8 years ago)
Author:
bennylp
Message:

Closed #1690: Assertion in timer in SIP transaction: Timer being rescheduled when already running

Location:
pjproject/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/timer.h

    r4359 r4567  
    212212                                              void *user_data, 
    213213                                              pj_timer_heap_callback *cb ); 
     214 
     215/** 
     216 * Queries whether a timer entry is currently running. 
     217 * 
     218 * @param entry     The timer entry to query. 
     219 * 
     220 * @return          PJ_TRUE if the timer is running.  PJ_FALSE if not. 
     221 */ 
     222PJ_DECL(pj_bool_t) pj_timer_entry_running( pj_timer_entry *entry ); 
    214223 
    215224/** 
  • pjproject/trunk/pjlib/src/pj/timer.c

    r4537 r4567  
    467467} 
    468468 
     469PJ_DEF(pj_bool_t) pj_timer_entry_running( pj_timer_entry *entry ) 
     470{ 
     471    return (entry->_timer_id >= 1); 
     472} 
     473 
    469474#if PJ_TIMER_DEBUG 
    470475static pj_status_t schedule_w_grp_lock_dbg(pj_timer_heap_t *ht, 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r4537 r4567  
    22252225    pj_status_t status; 
    22262226 
     2227    if (resched && pj_timer_entry_running(&tsx->retransmit_timer)) { 
     2228        /* We've been asked to reschedule but the timer is already rerunning. 
     2229         * This can only happen in a race condition where, between removing 
     2230         * this retransmit timer from the heap and actually scheduling it, 
     2231         * another thread has got in and rescheduled the timer itself.  In 
     2232         * this scenario, the transmission has already happened and so we 
     2233         * should just quit out immediately, without either resending the 
     2234         * message or restarting the timer. 
     2235         */ 
     2236        return PJ_SUCCESS; 
     2237    } 
     2238 
    22272239    PJ_ASSERT_RETURN(tsx->last_tx!=NULL, PJ_EBUG); 
    22282240 
     
    23332345         */ 
    23342346        lock_timer(tsx); 
     2347        tsx_cancel_timer( tsx, &tsx->timeout_timer ); 
    23352348        tsx_schedule_timer( tsx, &tsx->timeout_timer, &timeout_timer_val, 
    23362349                            TIMEOUT_TIMER); 
     
    26782691 
    26792692                lock_timer(tsx); 
     2693                tsx_cancel_timer(tsx, &tsx->timeout_timer); 
    26802694                tsx_schedule_timer( tsx, &tsx->timeout_timer, 
    26812695                                    &timeout, TIMEOUT_TIMER); 
     
    27062720             */ 
    27072721            lock_timer(tsx); 
     2722            tsx_cancel_timer(tsx, &tsx->timeout_timer); 
    27082723            if (tsx->method.id == PJSIP_INVITE_METHOD) { 
    27092724                /* Start timer H for INVITE */ 
Note: See TracChangeset for help on using the changeset viewer.