summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_event_conn_job_sendfile.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2019-02-28 18:04:11 +0300
committerIgor Sysoev <igor@sysoev.ru>2019-02-28 18:04:11 +0300
commit834e8ca576868c5ecd104bd5ebec9968c7f80a0b (patch)
tree1574f2532ffd849666e78b6a68fc7a03cfa1eb34 /src/nxt_event_conn_job_sendfile.c
parentafda14d1f23cc49eee5939c25278eec3501d8631 (diff)
downloadunit-834e8ca576868c5ecd104bd5ebec9968c7f80a0b.tar.gz
unit-834e8ca576868c5ecd104bd5ebec9968c7f80a0b.tar.bz2
Fixed timer and event race condition.
When idle timeout occurs at the same time as a request comes in, the timer handler closes connection while the read event triggers request processing, and this eventually leads to segmentation fault.
Diffstat (limited to 'src/nxt_event_conn_job_sendfile.c')
-rw-r--r--src/nxt_event_conn_job_sendfile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nxt_event_conn_job_sendfile.c b/src/nxt_event_conn_job_sendfile.c
index 2ca6e421..0f6f9353 100644
--- a/src/nxt_event_conn_job_sendfile.c
+++ b/src/nxt_event_conn_job_sendfile.c
@@ -80,7 +80,8 @@ nxt_event_conn_job_sendfile_start(nxt_task_t *task, void *obj, void *data)
c->write = NULL;
jbs->ready_handler = nxt_event_conn_job_sendfile_return;
- c->blocked = 1;
+ c->block_read = 1;
+ c->block_write = 1;
nxt_job_start(task, &jbs->job, nxt_event_conn_job_sendfile_handler);
return;
@@ -170,7 +171,8 @@ nxt_event_conn_job_sendfile_return(nxt_task_t *task, void *obj, void *data)
jbs = obj;
c = data;
- c->blocked = 0;
+ c->block_read = 0;
+ c->block_write = 0;
sent = jbs->sent;
c->sent += sent;