diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-09-05 10:22:46 -0700 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-09-05 10:22:46 -0700 |
commit | c937b8434ab603fa0d256f9fc29229bc76683301 (patch) | |
tree | a19102c5729dbe6ca7dcefe1abfd9d396c3a890d /src/nxt_router.c | |
parent | 1429cacd1738e6d3dde3a155228c4109de50984a (diff) | |
download | unit-c937b8434ab603fa0d256f9fc29229bc76683301.tar.gz unit-c937b8434ab603fa0d256f9fc29229bc76683301.tar.bz2 |
Double connection close attempt fix.
Diffstat (limited to 'src/nxt_router.c')
-rw-r--r-- | src/nxt_router.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c index 3faca2c2..f557ebaf 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -2079,6 +2079,12 @@ nxt_router_gen_error(nxt_task_t *task, nxt_conn_t *c, int code, c->socket.data = NULL; } + if (c->socket.fd == -1) { + nxt_mp_release(c->mem_pool, b->next); + nxt_mp_release(c->mem_pool, b); + return; + } + if (c->write == NULL) { c->write = b; c->write_state = &nxt_router_conn_write_state; @@ -2654,6 +2660,7 @@ nxt_router_process_http_request(nxt_task_t *task, nxt_conn_t *c, nxt_debug(task, "req_id %uxD linked to conn %p at engine %p", req_id, c, engine); + c->socket.data = NULL; ra = nxt_router_ra_create(task, rc); @@ -3118,9 +3125,11 @@ nxt_router_conn_error(nxt_task_t *task, void *obj, void *data) nxt_debug(task, "router conn error"); - c->write_state = &nxt_router_conn_close_state; + if (c->socket.fd != -1) { + c->write_state = &nxt_router_conn_close_state; - nxt_conn_close(task->thread->engine, c); + nxt_conn_close(task->thread->engine, c); + } } |