Mercurial > hg > nginx
comparison src/http/v3/ngx_http_v3_request.c @ 8742:47a43b011dec quic
HTTP/3: keepalive_time support.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 16 Apr 2021 19:42:03 +0300 |
parents | a64255c01dab |
children | 40d710a66aef |
comparison
equal
deleted
inserted
replaced
8741:7f95010f10b7 | 8742:47a43b011dec |
---|---|
79 | 79 |
80 hc = c->data; | 80 hc = c->data; |
81 | 81 |
82 clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module); | 82 clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module); |
83 | 83 |
84 n = c->quic->id >> 2; | 84 h3c = c->quic->parent->data; |
85 | 85 |
86 if (n >= clcf->keepalive_requests) { | 86 if (h3c->goaway) { |
87 ngx_quic_reset_stream(c, NGX_HTTP_V3_ERR_REQUEST_REJECTED); | 87 ngx_quic_reset_stream(c, NGX_HTTP_V3_ERR_REQUEST_REJECTED); |
88 ngx_http_close_connection(c); | 88 ngx_http_close_connection(c); |
89 return; | 89 return; |
90 } | 90 } |
91 | 91 |
92 if (n + 1 == clcf->keepalive_requests) { | 92 n = c->quic->id >> 2; |
93 | |
94 if (n + 1 == clcf->keepalive_requests | |
95 || ngx_current_msec - c->quic->parent->start_time | |
96 > clcf->keepalive_time) | |
97 { | |
98 h3c->goaway = 1; | |
99 | |
93 if (ngx_http_v3_send_goaway(c, (n + 1) << 2) != NGX_OK) { | 100 if (ngx_http_v3_send_goaway(c, (n + 1) << 2) != NGX_OK) { |
94 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR, | 101 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR, |
95 "goaway error"); | 102 "goaway error"); |
96 ngx_http_close_connection(c); | 103 ngx_http_close_connection(c); |
97 return; | 104 return; |
108 } | 115 } |
109 | 116 |
110 cln->handler = ngx_http_v3_cleanup_request; | 117 cln->handler = ngx_http_v3_cleanup_request; |
111 cln->data = c; | 118 cln->data = c; |
112 | 119 |
113 h3c = c->quic->parent->data; | |
114 h3c->nrequests++; | 120 h3c->nrequests++; |
115 | 121 |
116 if (h3c->keepalive.timer_set) { | 122 if (h3c->keepalive.timer_set) { |
117 ngx_del_timer(&h3c->keepalive); | 123 ngx_del_timer(&h3c->keepalive); |
118 } | 124 } |