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'.
This commit is contained in:
Vladimir Homutov 2020-11-06 18:21:31 +03:00
parent 4598902e81
commit 211af3d876

View file

@ -1020,7 +1020,7 @@ ngx_quic_new_connection(ngx_connection_t *c, ngx_quic_conf_t *conf,
qc->congestion.window = ngx_min(10 * qc->tp.max_udp_payload_size, qc->congestion.window = ngx_min(10 * qc->tp.max_udp_payload_size,
ngx_max(2 * qc->tp.max_udp_payload_size, ngx_max(2 * qc->tp.max_udp_payload_size,
14720)); 14720));
qc->congestion.ssthresh = NGX_MAX_SIZE_T_VALUE; qc->congestion.ssthresh = (size_t) -1;
qc->congestion.recovery_start = ngx_current_msec; qc->congestion.recovery_start = ngx_current_msec;
if (ngx_quic_new_dcid(c, qc, &pkt->dcid) != NGX_OK) { if (ngx_quic_new_dcid(c, qc, &pkt->dcid) != NGX_OK) {
@ -2572,8 +2572,8 @@ ngx_quic_ack_packet(ngx_connection_t *c, ngx_quic_header_t *pkt)
ctx = ngx_quic_get_send_ctx(c->quic, pkt->level); ctx = ngx_quic_get_send_ctx(c->quic, pkt->level);
ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
"quic ngx_quic_ack_packet pn:%uL largest %uL fr:%uL" "quic ngx_quic_ack_packet pn:%uL largest %L fr:%uL"
" nranges:%ui", pkt->pn, ctx->largest_range, " nranges:%ui", pkt->pn, (int64_t) ctx->largest_range,
ctx->first_range, ctx->nranges); ctx->first_range, ctx->nranges);
prev_pending = ctx->pending_ack; prev_pending = ctx->pending_ack;
@ -5710,7 +5710,7 @@ ngx_quic_congestion_ack(ngx_connection_t *c, ngx_quic_frame_t *f)
if ((ngx_msec_int_t) timer <= 0) { if ((ngx_msec_int_t) timer <= 0) {
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 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); cg->window, cg->ssthresh, cg->in_flight);
return; return;
@ -5720,14 +5720,14 @@ ngx_quic_congestion_ack(ngx_connection_t *c, ngx_quic_frame_t *f)
cg->window += f->plen; cg->window += f->plen;
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 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); cg->window, cg->ssthresh, cg->in_flight);
} else { } else {
cg->window += qc->tp.max_udp_payload_size * f->plen / cg->window; cg->window += qc->tp.max_udp_payload_size * f->plen / cg->window;
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 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); cg->window, cg->ssthresh, cg->in_flight);
} }
@ -5762,7 +5762,7 @@ ngx_quic_congestion_lost(ngx_connection_t *c, ngx_quic_frame_t *f)
if ((ngx_msec_int_t) timer <= 0) { if ((ngx_msec_int_t) timer <= 0) {
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 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); cg->window, cg->ssthresh, cg->in_flight);
return; return;
@ -5778,7 +5778,7 @@ ngx_quic_congestion_lost(ngx_connection_t *c, ngx_quic_frame_t *f)
cg->ssthresh = cg->window; cg->ssthresh = cg->window;
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 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); cg->window, cg->ssthresh, cg->in_flight);
} }