Browse code

- fixed (SEND_BUFFER( r_buf )<=0 bug in timer.c (reported by Miklos Tirpak <mtirpak@sztaki.hu>). - now send_pr_buffer is called w/ file/function/line debugging info only if compiling w/ -DEXTRA_DEBUG

Andrei Pelinescu-Onciul authored on 13/03/2003 11:05:18
Showing 3 changed files
... ...
@@ -31,6 +31,8 @@
31 31
  * -------
32 32
  *  2003-03-01  start_retr changed to retransmit only for UDP
33 33
  *  2003-02-13  modified send_pr_buffer to use msg_send & rb->dst (andrei)
34
+ *  2003-03-13  send_pr_buffer is called w/ file/function/line debugging
35
+ *               info only if compiling w/ -DEXTRA_DEBUG (andrei)
34 36
  */
35 37
 
36 38
 
... ...
@@ -52,16 +54,23 @@
52 54
 
53 55
 
54 56
 /* ----------------------------------------------------- */
55
-
56
-int send_pr_buffer( struct retr_buf *rb,
57
-	void *buf, int len, char *function, int line )
57
+int send_pr_buffer(	struct retr_buf *rb, void *buf, int len
58
+#ifdef EXTRA_DEBUG
59
+						, char* file, char *function, int line
60
+#endif
61
+					)
58 62
 {
59 63
 	if (buf && len && rb )
60 64
 		return msg_send( rb->dst.send_sock, rb->dst.proto, &rb->dst.to,
61 65
 				         rb->dst.proto_reserved1, buf, len);
62 66
 	else {
63
-		LOG(L_CRIT, "ERROR: sending an empty buffer from %s (%d)\n",
64
-			function, line );
67
+#ifdef EXTRA_DEBUG
68
+		LOG(L_CRIT, "ERROR: send_pr_buffer: sending an empty buffer"
69
+				"from %s: %s (%d)\n", file, function, line );
70
+#else
71
+		LOG(L_CRIT, "ERROR: send_pr_buffer: attempt to send an "
72
+				"empty buffer\n");
73
+#endif
65 74
 		return -1;
66 75
 	}
67 76
 }
... ...
@@ -29,6 +29,8 @@
29 29
   *  2003-02-18  updated various function prototypes (andrei)
30 30
   *  2003-03-10  removed ifdef _OBSO & made redefined all the *UNREF* macros
31 31
   *               in a non-gcc specific way (andrei)
32
+  *  2003-03-13  now send_pr_buffer will be called w/ function/line info
33
+  *               only when compiling w/ -DEXTRA_DEBUG (andrei)
32 34
   */
33 35
 
34 36
 
... ...
@@ -75,14 +77,20 @@ extern int noisy_ctimer;
75 77
    for reducing time spend in REPLIES locks
76 78
 */
77 79
 
78
-int send_pr_buffer( struct retr_buf *rb,
79
-	void *buf, int len, char *function, int line );
80 80
 
81 81
 /* send a buffer -- 'PR' means private, i.e., it is assumed noone
82 82
    else can affect the buffer during sending time
83 83
 */
84
+#ifdef EXTRA_DEBUG
85
+int send_pr_buffer( struct retr_buf *rb,
86
+	void *buf, int len, char* file, char *function, int line );
84 87
 #define SEND_PR_BUFFER(_rb,_bf,_le ) \
85
-	send_pr_buffer( (_rb), (_bf), (_le),  __FUNCTION__, __LINE__ )
88
+	send_pr_buffer( (_rb), (_bf), (_le), __FILE__,  __FUNCTION__, __LINE__ )
89
+#else
90
+int send_pr_buffer( struct retr_buf *rb, void *buf, int len);
91
+#define SEND_PR_BUFFER(_rb,_bf,_le ) \
92
+	send_pr_buffer( (_rb), (_bf), (_le))
93
+#endif
86 94
 
87 95
 #define SEND_BUFFER( _rb ) \
88 96
 	SEND_PR_BUFFER( (_rb) , (_rb)->buffer , (_rb)->buffer_len )
... ...
@@ -280,7 +280,7 @@ inline static void retransmission_handler( void *attr)
280 280
 			DBG("DEBUG: retransmission_handler : "
281 281
 				"request resending (t=%p, %.9s ... )\n", 
282 282
 				r_buf->my_T, r_buf->buffer);
283
-			if (SEND_BUFFER( r_buf )<=0) {
283
+			if (SEND_BUFFER( r_buf )==-1) {
284 284
 				reset_timer( &r_buf->fr_timer );
285 285
 				fake_reply(r_buf->my_T, r_buf->branch, 503 );
286 286
 				return;