comparison src/event/ngx_event_quic.c @ 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
comparison
equal deleted inserted replaced
8622:183275308d9a 8623:8550b91e8e35
1018 qc->streams.client_max_streams_bidi = qc->tp.initial_max_streams_bidi; 1018 qc->streams.client_max_streams_bidi = qc->tp.initial_max_streams_bidi;
1019 1019
1020 qc->congestion.window = ngx_min(10 * qc->tp.max_udp_payload_size, 1020 qc->congestion.window = ngx_min(10 * qc->tp.max_udp_payload_size,
1021 ngx_max(2 * qc->tp.max_udp_payload_size, 1021 ngx_max(2 * qc->tp.max_udp_payload_size,
1022 14720)); 1022 14720));
1023 qc->congestion.ssthresh = NGX_MAX_SIZE_T_VALUE; 1023 qc->congestion.ssthresh = (size_t) -1;
1024 qc->congestion.recovery_start = ngx_current_msec; 1024 qc->congestion.recovery_start = ngx_current_msec;
1025 1025
1026 if (ngx_quic_new_dcid(c, qc, &pkt->dcid) != NGX_OK) { 1026 if (ngx_quic_new_dcid(c, qc, &pkt->dcid) != NGX_OK) {
1027 return NULL; 1027 return NULL;
1028 } 1028 }
2570 c->log->action = "preparing ack"; 2570 c->log->action = "preparing ack";
2571 2571
2572 ctx = ngx_quic_get_send_ctx(c->quic, pkt->level); 2572 ctx = ngx_quic_get_send_ctx(c->quic, pkt->level);
2573 2573
2574 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, 2574 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
2575 "quic ngx_quic_ack_packet pn:%uL largest %uL fr:%uL" 2575 "quic ngx_quic_ack_packet pn:%uL largest %L fr:%uL"
2576 " nranges:%ui", pkt->pn, ctx->largest_range, 2576 " nranges:%ui", pkt->pn, (int64_t) ctx->largest_range,
2577 ctx->first_range, ctx->nranges); 2577 ctx->first_range, ctx->nranges);
2578 2578
2579 prev_pending = ctx->pending_ack; 2579 prev_pending = ctx->pending_ack;
2580 2580
2581 if (pkt->need_ack) { 2581 if (pkt->need_ack) {
5708 5708
5709 timer = f->last - cg->recovery_start; 5709 timer = f->last - cg->recovery_start;
5710 5710
5711 if ((ngx_msec_int_t) timer <= 0) { 5711 if ((ngx_msec_int_t) timer <= 0) {
5712 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 5712 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
5713 "quic congestion ack recovery win:%uz ss:%uz if:%uz", 5713 "quic congestion ack recovery win:%uz ss:%z if:%uz",
5714 cg->window, cg->ssthresh, cg->in_flight); 5714 cg->window, cg->ssthresh, cg->in_flight);
5715 5715
5716 return; 5716 return;
5717 } 5717 }
5718 5718
5719 if (cg->window < cg->ssthresh) { 5719 if (cg->window < cg->ssthresh) {
5720 cg->window += f->plen; 5720 cg->window += f->plen;
5721 5721
5722 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 5722 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
5723 "quic congestion slow start win:%uz ss:%uz if:%uz", 5723 "quic congestion slow start win:%uz ss:%z if:%uz",
5724 cg->window, cg->ssthresh, cg->in_flight); 5724 cg->window, cg->ssthresh, cg->in_flight);
5725 5725
5726 } else { 5726 } else {
5727 cg->window += qc->tp.max_udp_payload_size * f->plen / cg->window; 5727 cg->window += qc->tp.max_udp_payload_size * f->plen / cg->window;
5728 5728
5729 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 5729 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
5730 "quic congestion avoidance win:%uz ss:%uz if:%uz", 5730 "quic congestion avoidance win:%uz ss:%z if:%uz",
5731 cg->window, cg->ssthresh, cg->in_flight); 5731 cg->window, cg->ssthresh, cg->in_flight);
5732 } 5732 }
5733 5733
5734 /* prevent recovery_start from wrapping */ 5734 /* prevent recovery_start from wrapping */
5735 5735
5760 5760
5761 timer = f->last - cg->recovery_start; 5761 timer = f->last - cg->recovery_start;
5762 5762
5763 if ((ngx_msec_int_t) timer <= 0) { 5763 if ((ngx_msec_int_t) timer <= 0) {
5764 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 5764 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
5765 "quic congestion lost recovery win:%uz ss:%uz if:%uz", 5765 "quic congestion lost recovery win:%uz ss:%z if:%uz",
5766 cg->window, cg->ssthresh, cg->in_flight); 5766 cg->window, cg->ssthresh, cg->in_flight);
5767 5767
5768 return; 5768 return;
5769 } 5769 }
5770 5770
5776 } 5776 }
5777 5777
5778 cg->ssthresh = cg->window; 5778 cg->ssthresh = cg->window;
5779 5779
5780 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 5780 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
5781 "quic congestion lost win:%uz ss:%uz if:%uz", 5781 "quic congestion lost win:%uz ss:%z if:%uz",
5782 cg->window, cg->ssthresh, cg->in_flight); 5782 cg->window, cg->ssthresh, cg->in_flight);
5783 } 5783 }
5784 5784
5785 5785
5786 static void 5786 static void