Mercurial > hg > nginx
comparison src/http/v2/ngx_http_v2.c @ 6783:9027991e2f37
HTTP/2: limited maximum number of requests in connection.
The new directive "http2_max_requests" is introduced. From users point of
view it works quite similar to "keepalive_requests" but has significantly
bigger default value that is more suitable for HTTP/2.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Mon, 31 Oct 2016 16:33:02 +0300 |
parents | 5e95b9fb33b7 |
children | 727c6412673a |
comparison
equal
deleted
inserted
replaced
6782:b123eae3fd4e | 6783:9027991e2f37 |
---|---|
324 | 324 |
325 h2c->blocked = 1; | 325 h2c->blocked = 1; |
326 | 326 |
327 if (c->close) { | 327 if (c->close) { |
328 c->close = 0; | 328 c->close = 0; |
329 h2c->goaway = 1; | 329 |
330 | 330 if (!h2c->goaway) { |
331 if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) == NGX_ERROR) { | 331 h2c->goaway = 1; |
332 ngx_http_v2_finalize_connection(h2c, 0); | 332 |
333 return; | 333 if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) |
334 } | 334 == NGX_ERROR) |
335 | 335 { |
336 if (ngx_http_v2_send_output_queue(h2c) == NGX_ERROR) { | 336 ngx_http_v2_finalize_connection(h2c, 0); |
337 ngx_http_v2_finalize_connection(h2c, 0); | 337 return; |
338 return; | 338 } |
339 | |
340 if (ngx_http_v2_send_output_queue(h2c) == NGX_ERROR) { | |
341 ngx_http_v2_finalize_connection(h2c, 0); | |
342 return; | |
343 } | |
339 } | 344 } |
340 | 345 |
341 h2c->blocked = 0; | 346 h2c->blocked = 0; |
342 | 347 |
343 return; | 348 return; |
1173 node->stream = stream; | 1178 node->stream = stream; |
1174 | 1179 |
1175 if (priority || node->parent == NULL) { | 1180 if (priority || node->parent == NULL) { |
1176 node->weight = weight; | 1181 node->weight = weight; |
1177 ngx_http_v2_set_dependency(h2c, node, depend, excl); | 1182 ngx_http_v2_set_dependency(h2c, node, depend, excl); |
1183 } | |
1184 | |
1185 if (h2c->connection->requests >= h2scf->max_requests) { | |
1186 h2c->goaway = 1; | |
1187 | |
1188 if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) == NGX_ERROR) { | |
1189 return ngx_http_v2_connection_error(h2c, | |
1190 NGX_HTTP_V2_INTERNAL_ERROR); | |
1191 } | |
1178 } | 1192 } |
1179 | 1193 |
1180 return ngx_http_v2_state_header_block(h2c, pos, end); | 1194 return ngx_http_v2_state_header_block(h2c, pos, end); |
1181 | 1195 |
1182 rst_stream: | 1196 rst_stream: |