|
@@ -64,10 +64,11 @@ static LIST_HEAD ( timers );
|
64
|
64
|
* be stopped and the timer's callback function will be called.
|
65
|
65
|
*/
|
66
|
66
|
void start_timer ( struct retry_timer *timer ) {
|
|
67
|
+ if ( ! timer->start )
|
|
68
|
+ list_add ( &timer->list, &timers );
|
67
|
69
|
timer->start = currticks();
|
68
|
70
|
if ( timer->timeout < MIN_TIMEOUT )
|
69
|
71
|
timer->timeout = MIN_TIMEOUT;
|
70
|
|
- list_add ( &timer->list, &timers );
|
71
|
72
|
DBG2 ( "Timer %p started\n", timer );
|
72
|
73
|
}
|
73
|
74
|
|
|
@@ -82,9 +83,14 @@ void stop_timer ( struct retry_timer *timer ) {
|
82
|
83
|
unsigned long old_timeout = timer->timeout;
|
83
|
84
|
unsigned long runtime;
|
84
|
85
|
|
|
86
|
+ /* If timer was already stopped, do nothing */
|
|
87
|
+ if ( ! timer->start )
|
|
88
|
+ return;
|
|
89
|
+
|
85
|
90
|
DBG2 ( "Timer %p stopped\n", timer );
|
86
|
91
|
list_del ( &timer->list );
|
87
|
92
|
runtime = currticks() - timer->start;
|
|
93
|
+ timer->start = 0;
|
88
|
94
|
|
89
|
95
|
/* Update timer. Variables are:
|
90
|
96
|
*
|
|
@@ -124,6 +130,7 @@ static void timer_expired ( struct retry_timer *timer ) {
|
124
|
130
|
/* Stop timer without performing RTT calculations */
|
125
|
131
|
DBG2 ( "Timer %p stopped on expiry\n", timer );
|
126
|
132
|
list_del ( &timer->list );
|
|
133
|
+ timer->start = 0;
|
127
|
134
|
timer->count++;
|
128
|
135
|
|
129
|
136
|
/* Back off the timeout value */
|