Changeset 1523


Ignore:
Timestamp:
Oct 26, 2007 3:59:34 AM (17 years ago)
Author:
bennylp
Message:

More ticket #399: fixed bug that triggers assertion in the timer

File:
1 edited

Legend:

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

    r1504 r1523  
    7979    pj_timer_heap_t         *timer_heap; 
    8080    pj_timer_entry           timer; 
     81    unsigned                 timer_executed; 
    8182 
    8283    void                    *user_data; 
     
    358359    char errmsg[PJ_ERR_MSG_SIZE]; 
    359360    pj_time_val delay; 
     361 
     362    if (sess->timer.id != 0) { 
     363        pj_timer_heap_cancel(sess->timer_heap, &sess->timer); 
     364        sess->timer.id = 0; 
     365    } 
    360366 
    361367    pj_bzero(&result, sizeof(result)); 
     
    831837    } else if (te->id == TIMER_TEST) { 
    832838 
    833         int executed; 
    834839        pj_bool_t next_timer; 
    835840 
    836841        pj_mutex_lock(sess->mutex); 
    837842 
    838         executed = test_executed(sess); 
    839843        next_timer = PJ_FALSE; 
    840844 
    841         if (executed == ST_TEST_1) { 
     845        if (sess->timer_executed == 0) { 
    842846            send_test(sess, ST_TEST_1, NULL, 0); 
    843847            next_timer = PJ_TRUE; 
    844         } else if (executed == ST_TEST_2) { 
     848        } else if (sess->timer_executed == 1) { 
    845849            send_test(sess, ST_TEST_2, NULL, CHANGE_IP_PORT_FLAG); 
    846850            next_timer = PJ_TRUE; 
    847         } else if (executed == ST_TEST_3) { 
     851        } else if (sess->timer_executed == 2) { 
    848852            send_test(sess, ST_TEST_3, NULL, CHANGE_PORT_FLAG); 
    849853        } else { 
    850854            pj_assert(!"Shouldn't have timer at this state"); 
    851855        } 
     856 
     857        ++sess->timer_executed; 
    852858 
    853859        if (next_timer) { 
Note: See TracChangeset for help on using the changeset viewer.