diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2021-02-17 14:48:35 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2021-02-17 14:48:35 +0300 |
commit | 8ca2f73073da431d8e747589eac5b49a7c0faa5b (patch) | |
tree | 6d5f46eb2dccc4cacc13a3e353f78f940f310bbb /src/core/ngx_connection.c | |
parent | b93b056261114022b08f11413f959d3af687b7a7 (diff) | |
parent | 949c97007b9c6010e958c36653e33c3f5bf34540 (diff) | |
download | nginx-8ca2f73073da431d8e747589eac5b49a7c0faa5b.tar.gz nginx-8ca2f73073da431d8e747589eac5b49a7c0faa5b.zip |
Merged with the default branch.
Diffstat (limited to 'src/core/ngx_connection.c')
-rw-r--r-- | src/core/ngx_connection.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c index 21f9980f2..2c0346f6b 100644 --- a/src/core/ngx_connection.c +++ b/src/core/ngx_connection.c @@ -1316,6 +1316,7 @@ ngx_drain_connections(ngx_cycle_t *cycle) cycle->connection_n); } + c = NULL; n = ngx_max(ngx_min(32, cycle->reusable_connections_n / 8), 1); for (i = 0; i < n; i++) { @@ -1332,6 +1333,21 @@ ngx_drain_connections(ngx_cycle_t *cycle) c->close = 1; c->read->handler(c->read); } + + if (cycle->free_connection_n == 0 && c && c->reusable) { + + /* + * if no connections were freed, try to reuse the last + * connection again: this should free it as long as + * previous reuse moved it to lingering close + */ + + ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0, + "reusing connection again"); + + c->close = 1; + c->read->handler(c->read); + } } |