comparison src/event/ngx_event_quic.c @ 8275:19660929e8ff quic

Logging cleanup. + Client-related errors (i.e. parsing) are done at INFO level + c->log->action is updated through the process of receiving, parsing. handling packet/payload and generating frames/output.
author Vladimir Homutov <vl@nginx.com>
date Tue, 24 Mar 2020 17:03:39 +0300
parents ee53bfd8f9ed
children 146687b1ab43
comparison
equal deleted inserted replaced
8274:ee53bfd8f9ed 8275:19660929e8ff
399 399
400 if (ngx_quic_parse_initial_header(pkt) != NGX_OK) { 400 if (ngx_quic_parse_initial_header(pkt) != NGX_OK) {
401 return NGX_ERROR; 401 return NGX_ERROR;
402 } 402 }
403 403
404 c->log->action = "creating new quic connection";
405
404 qc = ngx_pcalloc(c->pool, sizeof(ngx_quic_connection_t)); 406 qc = ngx_pcalloc(c->pool, sizeof(ngx_quic_connection_t));
405 if (qc == NULL) { 407 if (qc == NULL) {
406 return NGX_ERROR; 408 return NGX_ERROR;
407 } 409 }
408 410
790 ssize_t len; 792 ssize_t len;
791 ngx_uint_t ack_this, do_close; 793 ngx_uint_t ack_this, do_close;
792 ngx_quic_frame_t frame, *ack_frame; 794 ngx_quic_frame_t frame, *ack_frame;
793 ngx_quic_connection_t *qc; 795 ngx_quic_connection_t *qc;
794 796
795 c->log->action = "processing quic payload";
796 797
797 qc = c->quic; 798 qc = c->quic;
798 799
799 p = pkt->payload.data; 800 p = pkt->payload.data;
800 end = p + pkt->payload.len; 801 end = p + pkt->payload.len;
801 802
802 ack_this = 0; 803 ack_this = 0;
803 do_close = 0; 804 do_close = 0;
804 805
805 while (p < end) { 806 while (p < end) {
807
808 c->log->action = "parsing frames";
806 809
807 len = ngx_quic_parse_frame(pkt, p, end, &frame); 810 len = ngx_quic_parse_frame(pkt, p, end, &frame);
808 811
809 if (len == NGX_DECLINED) { 812 if (len == NGX_DECLINED) {
810 /* TODO: handle protocol violation: 813 /* TODO: handle protocol violation:
814 } 817 }
815 818
816 if (len < 0) { 819 if (len < 0) {
817 return NGX_ERROR; 820 return NGX_ERROR;
818 } 821 }
822
823 c->log->action = "handling frames";
819 824
820 p += len; 825 p += len;
821 826
822 switch (frame.type) { 827 switch (frame.type) {
823 828
930 if (ack_this == 0) { 935 if (ack_this == 0) {
931 /* do not ack packets with ACKs and PADDING */ 936 /* do not ack packets with ACKs and PADDING */
932 return NGX_OK; 937 return NGX_OK;
933 } 938 }
934 939
940 c->log->action = "generating acknowledgment";
941
935 // packet processed, ACK it now if required 942 // packet processed, ACK it now if required
936 // TODO: if (ack_required) ... - currently just ack each packet 943 // TODO: if (ack_required) ... - currently just ack each packet
937 944
938 ack_frame = ngx_pcalloc(c->pool, sizeof(ngx_quic_frame_t)); 945 ack_frame = ngx_pcalloc(c->pool, sizeof(ngx_quic_frame_t));
939 if (ack_frame == NULL) { 946 if (ack_frame == NULL) {
1193 qc = c->quic; 1200 qc = c->quic;
1194 1201
1195 if (qc->frames == NULL) { 1202 if (qc->frames == NULL) {
1196 return NGX_OK; 1203 return NGX_OK;
1197 } 1204 }
1205
1206 c->log->action = "sending frames";
1198 1207
1199 lvl = qc->frames->level; 1208 lvl = qc->frames->level;
1200 start = qc->frames; 1209 start = qc->frames;
1201 f = start; 1210 f = start;
1202 1211