Mercurial > hg > nginx
comparison src/http/v2/ngx_http_v2.c @ 7611:8e64e11aaca0
HTTP/2: introduced separate handler to retry stream close.
When ngx_http_v2_close_stream_handler() is used to retry stream close
after queued frames are sent, client timeouts on the stream can be
logged multiple times and/or in addition to already happened errors.
To resolve this, separate ngx_http_v2_retry_close_stream_handler()
was introduced, which does not try to log timeouts.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 23 Dec 2019 21:25:21 +0300 |
parents | 82c1339e2637 |
children | 8a7b59347401 |
comparison
equal
deleted
inserted
replaced
7610:82c1339e2637 | 7611:8e64e11aaca0 |
---|---|
176 static void ngx_http_v2_read_client_request_body_handler(ngx_http_request_t *r); | 176 static void ngx_http_v2_read_client_request_body_handler(ngx_http_request_t *r); |
177 | 177 |
178 static ngx_int_t ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c, | 178 static ngx_int_t ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c, |
179 ngx_http_v2_stream_t *stream, ngx_uint_t status); | 179 ngx_http_v2_stream_t *stream, ngx_uint_t status); |
180 static void ngx_http_v2_close_stream_handler(ngx_event_t *ev); | 180 static void ngx_http_v2_close_stream_handler(ngx_event_t *ev); |
181 static void ngx_http_v2_retry_close_stream_handler(ngx_event_t *ev); | |
181 static void ngx_http_v2_handle_connection_handler(ngx_event_t *rev); | 182 static void ngx_http_v2_handle_connection_handler(ngx_event_t *rev); |
182 static void ngx_http_v2_idle_handler(ngx_event_t *rev); | 183 static void ngx_http_v2_idle_handler(ngx_event_t *rev); |
183 static void ngx_http_v2_finalize_connection(ngx_http_v2_connection_t *h2c, | 184 static void ngx_http_v2_finalize_connection(ngx_http_v2_connection_t *h2c, |
184 ngx_uint_t status); | 185 ngx_uint_t status); |
185 | 186 |
4287 | 4288 |
4288 fc = stream->request->connection; | 4289 fc = stream->request->connection; |
4289 | 4290 |
4290 if (stream->queued) { | 4291 if (stream->queued) { |
4291 fc->error = 1; | 4292 fc->error = 1; |
4292 fc->write->handler = ngx_http_v2_close_stream_handler; | 4293 fc->write->handler = ngx_http_v2_retry_close_stream_handler; |
4293 fc->read->handler = ngx_http_v2_close_stream_handler; | 4294 fc->read->handler = ngx_http_v2_retry_close_stream_handler; |
4294 return; | 4295 return; |
4295 } | 4296 } |
4296 | 4297 |
4297 if (!stream->rst_sent && !h2c->connection->error) { | 4298 if (!stream->rst_sent && !h2c->connection->error) { |
4298 | 4299 |
4405 fc->timedout = 1; | 4406 fc->timedout = 1; |
4406 | 4407 |
4407 ngx_http_v2_close_stream(r->stream, NGX_HTTP_REQUEST_TIME_OUT); | 4408 ngx_http_v2_close_stream(r->stream, NGX_HTTP_REQUEST_TIME_OUT); |
4408 return; | 4409 return; |
4409 } | 4410 } |
4411 | |
4412 ngx_http_v2_close_stream(r->stream, 0); | |
4413 } | |
4414 | |
4415 | |
4416 static void | |
4417 ngx_http_v2_retry_close_stream_handler(ngx_event_t *ev) | |
4418 { | |
4419 ngx_connection_t *fc; | |
4420 ngx_http_request_t *r; | |
4421 | |
4422 fc = ev->data; | |
4423 r = fc->data; | |
4424 | |
4425 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, fc->log, 0, | |
4426 "http2 retry close stream handler"); | |
4410 | 4427 |
4411 ngx_http_v2_close_stream(r->stream, 0); | 4428 ngx_http_v2_close_stream(r->stream, 0); |
4412 } | 4429 } |
4413 | 4430 |
4414 | 4431 |