summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2019-11-14 16:39:48 +0300
committerIgor Sysoev <igor@sysoev.ru>2019-11-14 16:39:48 +0300
commitd4e3951c4de0d17db943ea4a6ee1c9f570979358 (patch)
tree0fa17beb691b596ebea2a7c1718532abd7a5a976
parent14e56fe8c869af490f76b7e88ac5d02a7ab4dd89 (diff)
downloadunit-d4e3951c4de0d17db943ea4a6ee1c9f570979358.tar.gz
unit-d4e3951c4de0d17db943ea4a6ee1c9f570979358.tar.bz2
Using request task.
-rw-r--r--src/nxt_h1proto.c10
-rw-r--r--src/nxt_http.h1
-rw-r--r--src/nxt_http_request.c4
3 files changed, 13 insertions, 2 deletions
diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c
index 11e15af9..6d24bade 100644
--- a/src/nxt_h1proto.c
+++ b/src/nxt_h1proto.c
@@ -424,6 +424,12 @@ nxt_h1p_conn_request_init(nxt_task_t *task, void *obj, void *data)
r->tls = c->u.tls;
#endif
+ r->task = c->task;
+ task = &r->task;
+ c->socket.task = task;
+ c->read_timer.task = task;
+ c->write_timer.task = task;
+
ret = nxt_http_parse_request_init(&h1p->parser, r->mem_pool);
if (nxt_fast_path(ret == NXT_OK)) {
@@ -1485,6 +1491,10 @@ nxt_h1p_request_close(nxt_task_t *task, nxt_http_proto_t proto,
nxt_router_conf_release(task, joint);
c = h1p->conn;
+ task = &c->task;
+ c->socket.task = task;
+ c->read_timer.task = task;
+ c->write_timer.task = task;
if (h1p->keepalive) {
nxt_h1p_keepalive(task, h1p, c);
diff --git a/src/nxt_http.h b/src/nxt_http.h
index 7bc9a0a8..bbfaa33e 100644
--- a/src/nxt_http.h
+++ b/src/nxt_http.h
@@ -137,6 +137,7 @@ struct nxt_http_request_s {
nxt_sockaddr_t *remote;
nxt_sockaddr_t *local;
void *tls;
+ nxt_task_t task;
nxt_timer_t timer;
void *timer_data;
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c
index 1f7a1796..394411a9 100644
--- a/src/nxt_http_request.c
+++ b/src/nxt_http_request.c
@@ -570,9 +570,9 @@ nxt_http_request_close_handler(nxt_task_t *task, void *obj, void *data)
if (nxt_fast_path(proto.any != NULL)) {
protocol = r->protocol;
- nxt_mp_release(r->mem_pool);
-
nxt_http_proto[protocol].close(task, proto, conf);
+
+ nxt_mp_release(r->mem_pool);
}
}