changeset 8623:8550b91e8e35 quic

QUIC: added proper logging of special values. A number of unsigned variables has a special value, usually -1 or some maximum, which produces huge numeric value in logs and makes them hard to read. In order to distinguish such values in log, they are casted to the signed type and printed as literal '-1'.
author Vladimir Homutov <vl@nginx.com>
date Fri, 06 Nov 2020 18:21:31 +0300
parents 183275308d9a
children 340cd26158fb
files src/event/ngx_event_quic.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/ngx_event_quic.c	Mon Nov 02 17:38:11 2020 +0000
+++ b/src/event/ngx_event_quic.c	Fri Nov 06 18:21:31 2020 +0300
@@ -1020,7 +1020,7 @@
     qc->congestion.window = ngx_min(10 * qc->tp.max_udp_payload_size,
                                     ngx_max(2 * qc->tp.max_udp_payload_size,
                                             14720));
-    qc->congestion.ssthresh = NGX_MAX_SIZE_T_VALUE;
+    qc->congestion.ssthresh = (size_t) -1;
     qc->congestion.recovery_start = ngx_current_msec;
 
     if (ngx_quic_new_dcid(c, qc, &pkt->dcid) != NGX_OK) {
@@ -2572,8 +2572,8 @@
     ctx = ngx_quic_get_send_ctx(c->quic, pkt->level);
 
     ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
-                   "quic ngx_quic_ack_packet pn:%uL largest %uL fr:%uL"
-                   " nranges:%ui", pkt->pn, ctx->largest_range,
+                   "quic ngx_quic_ack_packet pn:%uL largest %L fr:%uL"
+                   " nranges:%ui", pkt->pn, (int64_t) ctx->largest_range,
                    ctx->first_range, ctx->nranges);
 
     prev_pending = ctx->pending_ack;
@@ -5710,7 +5710,7 @@
 
     if ((ngx_msec_int_t) timer <= 0) {
         ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
-                       "quic congestion ack recovery win:%uz ss:%uz if:%uz",
+                       "quic congestion ack recovery win:%uz ss:%z if:%uz",
                        cg->window, cg->ssthresh, cg->in_flight);
 
         return;
@@ -5720,14 +5720,14 @@
         cg->window += f->plen;
 
         ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
-                       "quic congestion slow start win:%uz ss:%uz if:%uz",
+                       "quic congestion slow start win:%uz ss:%z if:%uz",
                        cg->window, cg->ssthresh, cg->in_flight);
 
     } else {
         cg->window += qc->tp.max_udp_payload_size * f->plen / cg->window;
 
         ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
-                       "quic congestion avoidance win:%uz ss:%uz if:%uz",
+                       "quic congestion avoidance win:%uz ss:%z if:%uz",
                        cg->window, cg->ssthresh, cg->in_flight);
     }
 
@@ -5762,7 +5762,7 @@
 
     if ((ngx_msec_int_t) timer <= 0) {
         ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
-                       "quic congestion lost recovery win:%uz ss:%uz if:%uz",
+                       "quic congestion lost recovery win:%uz ss:%z if:%uz",
                        cg->window, cg->ssthresh, cg->in_flight);
 
         return;
@@ -5778,7 +5778,7 @@
     cg->ssthresh = cg->window;
 
     ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
-                   "quic congestion lost win:%uz ss:%uz if:%uz",
+                   "quic congestion lost win:%uz ss:%z if:%uz",
                    cg->window, cg->ssthresh, cg->in_flight);
 }