Browse Source

Added extra debugging

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
095fce14f8
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      src/net/retry.c

+ 6
- 3
src/net/retry.c View File

64
  * be stopped and the timer's callback function will be called.
64
  * be stopped and the timer's callback function will be called.
65
  */
65
  */
66
 void start_timer ( struct retry_timer *timer ) {
66
 void start_timer ( struct retry_timer *timer ) {
67
-	list_add ( &timer->list, &timers );
68
 	timer->start = currticks();
67
 	timer->start = currticks();
69
 	if ( timer->timeout < MIN_TIMEOUT )
68
 	if ( timer->timeout < MIN_TIMEOUT )
70
 		timer->timeout = MIN_TIMEOUT;
69
 		timer->timeout = MIN_TIMEOUT;
70
+	list_add ( &timer->list, &timers );
71
+	DBG2 ( "Timer %p started\n", timer );
71
 }
72
 }
72
 
73
 
73
 /**
74
 /**
81
 	unsigned long old_timeout = timer->timeout;
82
 	unsigned long old_timeout = timer->timeout;
82
 	unsigned long runtime;
83
 	unsigned long runtime;
83
 
84
 
85
+	DBG2 ( "Timer %p stopped\n", timer );
84
 	list_del ( &timer->list );
86
 	list_del ( &timer->list );
85
 	runtime = currticks() - timer->start;
87
 	runtime = currticks() - timer->start;
86
 
88
 
105
 		timer->timeout -= ( timer->timeout >> 3 );
107
 		timer->timeout -= ( timer->timeout >> 3 );
106
 		timer->timeout += ( runtime >> 1 );
108
 		timer->timeout += ( runtime >> 1 );
107
 		if ( timer->timeout != old_timeout ) {
109
 		if ( timer->timeout != old_timeout ) {
108
-			DBG ( "Timer updated to %dms\n",
110
+			DBG ( "Timer %p updated to %ldms\n", timer,
109
 			      ( ( 1000 * timer->timeout ) / TICKS_PER_SEC ) );
111
 			      ( ( 1000 * timer->timeout ) / TICKS_PER_SEC ) );
110
 		}
112
 		}
111
 	}
113
 	}
120
 	int fail;
122
 	int fail;
121
 
123
 
122
 	/* Stop timer without performing RTT calculations */
124
 	/* Stop timer without performing RTT calculations */
125
+	DBG2 ( "Timer %p stopped on expiry\n", timer );
123
 	list_del ( &timer->list );
126
 	list_del ( &timer->list );
124
 	timer->count++;
127
 	timer->count++;
125
 
128
 
127
 	timer->timeout <<= 1;
130
 	timer->timeout <<= 1;
128
 	if ( ( fail = ( timer->timeout > MAX_TIMEOUT ) ) )
131
 	if ( ( fail = ( timer->timeout > MAX_TIMEOUT ) ) )
129
 		timer->timeout = MAX_TIMEOUT;
132
 		timer->timeout = MAX_TIMEOUT;
130
-	DBG ( "Timer backed off to %dms\n",
133
+	DBG ( "Timer %p backed off to %ldms\n", timer,
131
 	      ( ( 1000 * timer->timeout ) / TICKS_PER_SEC ) );
134
 	      ( ( 1000 * timer->timeout ) / TICKS_PER_SEC ) );
132
 
135
 
133
 	/* Call expiry callback */
136
 	/* Call expiry callback */

Loading…
Cancel
Save