Mercurial > hg > nginx
comparison src/event/ngx_event_quic.h @ 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 | eee307399229 |
comparison
equal
deleted
inserted
replaced
8359:2f900ae486bc | 8360:f175006124d0 |
---|---|
85 //#define NGX_QUIC_DEBUG_PACKETS /* dump packet contents */ | 85 //#define NGX_QUIC_DEBUG_PACKETS /* dump packet contents */ |
86 //#define NGX_QUIC_DEBUG_FRAMES /* dump frames contents */ | 86 //#define NGX_QUIC_DEBUG_FRAMES /* dump frames contents */ |
87 //#define NGX_QUIC_DEBUG_FRAMES_ALLOC /* log frames alloc/reuse/free */ | 87 //#define NGX_QUIC_DEBUG_FRAMES_ALLOC /* log frames alloc/reuse/free */ |
88 //#define NGX_QUIC_DEBUG_CRYPTO | 88 //#define NGX_QUIC_DEBUG_CRYPTO |
89 | 89 |
90 | |
91 #if (NGX_DEBUG) | 90 #if (NGX_DEBUG) |
92 | 91 |
93 #define ngx_quic_hexdump(log, fmt, data, len, ...) \ | 92 #define ngx_quic_hexdump(log, label, data, len) \ |
94 do { \ | 93 do { \ |
95 ngx_int_t m; \ | 94 ngx_int_t m; \ |
96 u_char buf[2048]; \ | 95 u_char buf[2048]; \ |
97 \ | 96 \ |
98 if (log->log_level & NGX_LOG_DEBUG_EVENT) { \ | 97 if (log->log_level & NGX_LOG_DEBUG_EVENT) { \ |
99 m = ngx_hex_dump(buf, (u_char *) data, ngx_min(len, 1024)) - buf; \ | 98 m = ngx_hex_dump(buf, (u_char *) data, ngx_min(len, 1024)) - buf; \ |
100 ngx_log_debug(NGX_LOG_DEBUG_EVENT, log, 0, \ | 99 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, log, 0, \ |
101 "%s: " fmt " %*s%s, len: %uz", \ | 100 label " len:%uz data:%*s%s", \ |
102 __FUNCTION__, __VA_ARGS__, m, buf, \ | 101 len, m, buf, len < 2048 ? "" : "..."); \ |
103 len < 2048 ? "" : "...", len); \ | |
104 } \ | 102 } \ |
105 } while (0) | 103 } while (0) |
106 | 104 |
107 #else | 105 #else |
108 | 106 |
109 #define ngx_quic_hexdump(log, fmt, data, len, ...) | 107 #define ngx_quic_hexdump(log, fmt, data, len) |
110 | 108 |
111 #endif | 109 #endif |
112 | 110 |
113 #define ngx_quic_hexdump0(log, fmt, data, len) \ | |
114 ngx_quic_hexdump(log, fmt "%s", data, len, "") \ | |
115 | |
116 | |
117 #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */ | 111 #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */ |