summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2018-04-12 17:11:34 +0300
committerIgor Sysoev <igor@sysoev.ru>2018-04-12 17:11:34 +0300
commit8afa51415efcbd1d1fc690e1ddb99e9eb06d12fa (patch)
treef59e1fbb22c173bf0c5250f7ceed486adb00a39b
parent8e9a95037482770f8cf3ac1d59f76c29f313c977 (diff)
downloadunit-8afa51415efcbd1d1fc690e1ddb99e9eb06d12fa.tar.gz
unit-8afa51415efcbd1d1fc690e1ddb99e9eb06d12fa.tar.bz2
Disabling timer when request header has been entirely read.
-rw-r--r--src/nxt_h1proto.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c
index 03f232b1..3eaabce7 100644
--- a/src/nxt_h1proto.c
+++ b/src/nxt_h1proto.c
@@ -179,6 +179,7 @@ static const nxt_conn_state_t nxt_h1p_idle_state
.timer_handler = nxt_h1p_conn_timeout,
.timer_value = nxt_h1p_conn_timeout_value,
.timer_data = offsetof(nxt_socket_conf_t, idle_timeout),
+ .timer_autoreset = 1,
};
@@ -307,10 +308,14 @@ nxt_h1p_conn_header_parse(nxt_task_t *task, void *obj, void *data)
ret = nxt_http_parse_request(&h1p->parser, &c->read->mem);
- r = h1p->request;
-
ret = nxt_expect(NXT_DONE, ret);
+ if (ret != NXT_AGAIN) {
+ nxt_timer_disable(task->thread->engine, &c->read_timer);
+ }
+
+ r = h1p->request;
+
switch (ret) {
case NXT_DONE:
@@ -1076,6 +1081,7 @@ static const nxt_conn_state_t nxt_h1p_keepalive_state
.timer_handler = nxt_h1p_conn_timeout,
.timer_value = nxt_h1p_conn_timeout_value,
.timer_data = offsetof(nxt_socket_conf_t, idle_timeout),
+ .timer_autoreset = 1,
};