diff src/event/ngx_event_quic_transport.c @ 8360:f175006124d0 quic

Cleaned up hexdumps in debug output. - the ngx_quic_hexdump0() macro is renamed to ngx_quic_hexdump(); the original ngx_quic_hexdump() macro with variable argument is removed, extra information is logged normally, with ngx_log_debug() - all labels in hex dumps are prefixed with "quic" - the hexdump format is simplified, length is moved forward to avoid situations when the dump is truncated, and length is not shown - ngx_quic_flush_flight() function contents is debug-only, placed under NGX_DEBUG macro to avoid "unused variable" warnings from compiler - frame names in labels are capitalized, similar to other places
author Vladimir Homutov <vl@nginx.com>
date Fri, 24 Apr 2020 11:33:00 +0300
parents 2f900ae486bc
children 336d527ca031
line wrap: on
line diff
--- a/src/event/ngx_event_quic_transport.c
+++ b/src/event/ngx_event_quic_transport.c
@@ -235,7 +235,7 @@ ngx_quic_parse_long_header(ngx_quic_head
     end = pkt->data + pkt->len;
 
 #ifdef NGX_QUIC_DEBUG_PACKETS
-    ngx_quic_hexdump0(pkt->log, "long input", pkt->data, pkt->len);
+    ngx_quic_hexdump(pkt->log, "quic long packet in", pkt->data, pkt->len);
 #endif
 
     p = ngx_quic_read_uint8(p, end, &pkt->flags);
@@ -392,7 +392,7 @@ ngx_quic_parse_short_header(ngx_quic_hea
     end = pkt->data + pkt->len;
 
 #ifdef NGX_QUIC_DEBUG_PACKETS
-    ngx_quic_hexdump0(pkt->log, "short input", pkt->data, pkt->len);
+    ngx_quic_hexdump(pkt->log, "quic short packet in", pkt->data, pkt->len);
 #endif
 
     p = ngx_quic_read_uint8(p, end, &pkt->flags);
@@ -476,9 +476,9 @@ ngx_quic_parse_initial_header(ngx_quic_h
     pkt->len = varint;
 
 #ifdef NGX_QUIC_DEBUG_PACKETS
-    ngx_quic_hexdump0(pkt->log, "DCID", pkt->dcid.data, pkt->dcid.len);
-    ngx_quic_hexdump0(pkt->log, "SCID", pkt->scid.data, pkt->scid.len);
-    ngx_quic_hexdump0(pkt->log, "token", pkt->token.data, pkt->token.len);
+    ngx_quic_hexdump(pkt->log, "quic DCID", pkt->dcid.data, pkt->dcid.len);
+    ngx_quic_hexdump(pkt->log, "quic SCID", pkt->scid.data, pkt->scid.len);
+    ngx_quic_hexdump(pkt->log, "quic token", pkt->token.data, pkt->token.len);
 #endif
 
     return NGX_OK;
@@ -577,8 +577,8 @@ ngx_quic_parse_frame(ngx_quic_header_t *
                        f->u.crypto.data);
 
 #ifdef NGX_QUIC_DEBUG_FRAMES
-        ngx_quic_hexdump0(pkt->log, "CRYPTO frame contents",
-                          f->u.crypto.data, f->u.crypto.length);
+        ngx_quic_hexdump(pkt->log, "quic CRYPTO frame",
+                         f->u.crypto.data, f->u.crypto.length);
 #endif
         break;
 
@@ -837,8 +837,8 @@ ngx_quic_parse_frame(ngx_quic_header_t *
                        f->u.stream.fin);
 
 #ifdef NGX_QUIC_DEBUG_FRAMES
-            ngx_quic_hexdump0(pkt->log, "STREAM frame contents",
-                              f->u.stream.data, f->u.stream.length);
+            ngx_quic_hexdump(pkt->log, "quic STREAM frame",
+                             f->u.stream.data, f->u.stream.length);
 #endif
         break;
 
@@ -1080,8 +1080,8 @@ ngx_quic_parse_frame(ngx_quic_header_t *
                        "quic frame in: PATH_CHALLENGE");
 
 #ifdef NGX_QUIC_DEBUG_FRAMES
-        ngx_quic_hexdump0(pkt->log, "path challenge data",
-                          f->u.path_challenge.data, 8);
+        ngx_quic_hexdump(pkt->log, "quic PATH_CHALLENGE frame data",
+                         f->u.path_challenge.data, 8);
 #endif
         break;
 
@@ -1102,8 +1102,8 @@ ngx_quic_parse_frame(ngx_quic_header_t *
                        "quic frame in: PATH_RESPONSE");
 
 #ifdef NGX_QUIC_DEBUG_FRAMES
-        ngx_quic_hexdump0(pkt->log, "path response data",
-                          f->u.path_response.data, 8);
+        ngx_quic_hexdump(pkt->log, "quic PATH_RESPONSE frame data",
+                         f->u.path_response.data, 8);
 #endif
         break;