|
@@ -55,9 +55,10 @@ static LIST_HEAD ( timers );
|
55
|
55
|
* be stopped and the timer's callback function will be called.
|
56
|
56
|
*/
|
57
|
57
|
void start_timer ( struct retry_timer *timer ) {
|
58
|
|
- if ( ! timer_running ( timer ) )
|
|
58
|
+ if ( ! timer->running )
|
59
|
59
|
list_add ( &timer->list, &timers );
|
60
|
60
|
timer->start = currticks();
|
|
61
|
+ timer->running = 1;
|
61
|
62
|
|
62
|
63
|
/* 0 means "use default timeout" */
|
63
|
64
|
if ( timer->min_timeout == 0 )
|
|
@@ -82,6 +83,8 @@ void start_timer ( struct retry_timer *timer ) {
|
82
|
83
|
void start_timer_fixed ( struct retry_timer *timer, unsigned long timeout ) {
|
83
|
84
|
start_timer ( timer );
|
84
|
85
|
timer->timeout = timeout;
|
|
86
|
+ DBG2 ( "Timer %p expiry time changed to %ld\n",
|
|
87
|
+ timer, ( timer->start + timer->timeout ) );
|
85
|
88
|
}
|
86
|
89
|
|
87
|
90
|
/**
|
|
@@ -97,12 +100,12 @@ void stop_timer ( struct retry_timer *timer ) {
|
97
|
100
|
unsigned long runtime;
|
98
|
101
|
|
99
|
102
|
/* If timer was already stopped, do nothing */
|
100
|
|
- if ( ! timer_running ( timer ) )
|
|
103
|
+ if ( ! timer->running )
|
101
|
104
|
return;
|
102
|
105
|
|
103
|
106
|
list_del ( &timer->list );
|
104
|
107
|
runtime = ( now - timer->start );
|
105
|
|
- timer->start = 0;
|
|
108
|
+ timer->running = 0;
|
106
|
109
|
DBG2 ( "Timer %p stopped at time %ld (ran for %ld)\n",
|
107
|
110
|
timer, now, runtime );
|
108
|
111
|
|
|
@@ -144,8 +147,9 @@ static void timer_expired ( struct retry_timer *timer ) {
|
144
|
147
|
/* Stop timer without performing RTT calculations */
|
145
|
148
|
DBG2 ( "Timer %p stopped at time %ld on expiry\n",
|
146
|
149
|
timer, currticks() );
|
|
150
|
+ assert ( timer->running );
|
147
|
151
|
list_del ( &timer->list );
|
148
|
|
- timer->start = 0;
|
|
152
|
+ timer->running = 0;
|
149
|
153
|
timer->count++;
|
150
|
154
|
|
151
|
155
|
/* Back off the timeout value */
|