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,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
-	list_add ( &timer->list, &timers );
68 67
 	timer->start = currticks();
69 68
 	if ( timer->timeout < MIN_TIMEOUT )
70 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,6 +82,7 @@ void stop_timer ( struct retry_timer *timer ) {
81 82
 	unsigned long old_timeout = timer->timeout;
82 83
 	unsigned long runtime;
83 84
 
85
+	DBG2 ( "Timer %p stopped\n", timer );
84 86
 	list_del ( &timer->list );
85 87
 	runtime = currticks() - timer->start;
86 88
 
@@ -105,7 +107,7 @@ void stop_timer ( struct retry_timer *timer ) {
105 107
 		timer->timeout -= ( timer->timeout >> 3 );
106 108
 		timer->timeout += ( runtime >> 1 );
107 109
 		if ( timer->timeout != old_timeout ) {
108
-			DBG ( "Timer updated to %dms\n",
110
+			DBG ( "Timer %p updated to %ldms\n", timer,
109 111
 			      ( ( 1000 * timer->timeout ) / TICKS_PER_SEC ) );
110 112
 		}
111 113
 	}
@@ -120,6 +122,7 @@ static void timer_expired ( struct retry_timer *timer ) {
120 122
 	int fail;
121 123
 
122 124
 	/* Stop timer without performing RTT calculations */
125
+	DBG2 ( "Timer %p stopped on expiry\n", timer );
123 126
 	list_del ( &timer->list );
124 127
 	timer->count++;
125 128
 
@@ -127,7 +130,7 @@ static void timer_expired ( struct retry_timer *timer ) {
127 130
 	timer->timeout <<= 1;
128 131
 	if ( ( fail = ( timer->timeout > MAX_TIMEOUT ) ) )
129 132
 		timer->timeout = MAX_TIMEOUT;
130
-	DBG ( "Timer backed off to %dms\n",
133
+	DBG ( "Timer %p backed off to %ldms\n", timer,
131 134
 	      ( ( 1000 * timer->timeout ) / TICKS_PER_SEC ) );
132 135
 
133 136
 	/* Call expiry callback */

Loading…
Cancel
Save