Bläddra i källkod

[tcp] Move high-frequency debug messages to DBGLVL_EXTRA

This makes it possible to leave TCP debugging enabled in order to see
interesting TCP events, without flooding the console with at least one
message per packet.
tags/v0.9.8
Michael Brown 15 år sedan
förälder
incheckning
a2f753ba64
1 ändrade filer med 21 tillägg och 21 borttagningar
  1. 21
    21
      src/net/tcp.c

+ 21
- 21
src/net/tcp.c Visa fil

@@ -144,15 +144,15 @@ tcp_dump_state ( struct tcp_connection *tcp ) {
144 144
 static inline __attribute__ (( always_inline )) void
145 145
 tcp_dump_flags ( struct tcp_connection *tcp, unsigned int flags ) {
146 146
 	if ( flags & TCP_RST )
147
-		DBGC ( tcp, " RST" );
147
+		DBGC2 ( tcp, " RST" );
148 148
 	if ( flags & TCP_SYN )
149
-		DBGC ( tcp, " SYN" );
149
+		DBGC2 ( tcp, " SYN" );
150 150
 	if ( flags & TCP_PSH )
151
-		DBGC ( tcp, " PSH" );
151
+		DBGC2 ( tcp, " PSH" );
152 152
 	if ( flags & TCP_FIN )
153
-		DBGC ( tcp, " FIN" );
153
+		DBGC2 ( tcp, " FIN" );
154 154
 	if ( flags & TCP_ACK )
155
-		DBGC ( tcp, " ACK" );
155
+		DBGC2 ( tcp, " ACK" );
156 156
 }
157 157
 
158 158
 /***************************************************************************
@@ -487,12 +487,12 @@ static int tcp_xmit ( struct tcp_connection *tcp, int force_send ) {
487 487
 	tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );
488 488
 
489 489
 	/* Dump header */
490
-	DBGC ( tcp, "TCP %p TX %d->%d %08x..%08zx           %08x %4zd",
491
-	       tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
492
-	       ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) + seq_len ),
493
-	       ntohl ( tcphdr->ack ), len );
490
+	DBGC2 ( tcp, "TCP %p TX %d->%d %08x..%08zx           %08x %4zd",
491
+		tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
492
+		ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) + seq_len ),
493
+		ntohl ( tcphdr->ack ), len );
494 494
 	tcp_dump_flags ( tcp, tcphdr->flags );
495
-	DBGC ( tcp, "\n" );
495
+	DBGC2 ( tcp, "\n" );
496 496
 
497 497
 	/* Transmit packet */
498 498
 	return tcpip_tx ( iobuf, &tcp_protocol, NULL, &tcp->peer, NULL,
@@ -568,12 +568,12 @@ static int tcp_xmit_reset ( struct tcp_connection *tcp,
568 568
 	tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );
569 569
 
570 570
 	/* Dump header */
571
-	DBGC ( tcp, "TCP %p TX %d->%d %08x..%08x           %08x %4d",
572
-	       tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
573
-	       ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) ),
574
-	       ntohl ( tcphdr->ack ), 0 );
571
+	DBGC2 ( tcp, "TCP %p TX %d->%d %08x..%08x           %08x %4d",
572
+		tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
573
+		ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) ),
574
+		ntohl ( tcphdr->ack ), 0 );
575 575
 	tcp_dump_flags ( tcp, tcphdr->flags );
576
-	DBGC ( tcp, "\n" );
576
+	DBGC2 ( tcp, "\n" );
577 577
 
578 578
 	/* Transmit packet */
579 579
 	return tcpip_tx ( iobuf, &tcp_protocol, NULL, st_dest,
@@ -913,13 +913,13 @@ static int tcp_rx ( struct io_buffer *iobuf,
913 913
 	len = iob_len ( iobuf );
914 914
 
915 915
 	/* Dump header */
916
-	DBGC ( tcp, "TCP %p RX %d<-%d           %08x %08x..%08zx %4zd",
917
-	       tcp, ntohs ( tcphdr->dest ), ntohs ( tcphdr->src ),
918
-	       ntohl ( tcphdr->ack ), ntohl ( tcphdr->seq ),
919
-	       ( ntohl ( tcphdr->seq ) + len +
920
-		 ( ( tcphdr->flags & ( TCP_SYN | TCP_FIN ) ) ? 1 : 0 ) ), len);
916
+	DBGC2 ( tcp, "TCP %p RX %d<-%d           %08x %08x..%08zx %4zd",
917
+		tcp, ntohs ( tcphdr->dest ), ntohs ( tcphdr->src ),
918
+		ntohl ( tcphdr->ack ), ntohl ( tcphdr->seq ),
919
+		( ntohl ( tcphdr->seq ) + len +
920
+		  ( ( tcphdr->flags & ( TCP_SYN | TCP_FIN ) ) ? 1 : 0 )), len);
921 921
 	tcp_dump_flags ( tcp, tcphdr->flags );
922
-	DBGC ( tcp, "\n" );
922
+	DBGC2 ( tcp, "\n" );
923 923
 
924 924
 	/* If no connection was found, send RST */
925 925
 	if ( ! tcp ) {

Laddar…
Avbryt
Spara