diff options
author | Igor Sysoev <igor@sysoev.ru> | 2018-04-11 17:33:18 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2018-04-11 17:33:18 +0300 |
commit | c7e575d5c61c2b301207c751ae73186d7568857e (patch) | |
tree | 378c0a86a6dd256c239d7992134c0faeb2a4304a /src/nxt_conn_read.c | |
parent | 0be4f1f6938bf34c8ff5dacaf31716572404a10d (diff) | |
download | unit-c7e575d5c61c2b301207c751ae73186d7568857e.tar.gz unit-c7e575d5c61c2b301207c751ae73186d7568857e.tar.bz2 |
Introducing connection state io_read_handler.
Diffstat (limited to 'src/nxt_conn_read.c')
-rw-r--r-- | src/nxt_conn_read.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/nxt_conn_read.c b/src/nxt_conn_read.c index e7134b99..dce4268e 100644 --- a/src/nxt_conn_read.c +++ b/src/nxt_conn_read.c @@ -38,7 +38,6 @@ void nxt_conn_io_read(nxt_task_t *task, void *obj, void *data) { ssize_t n; - nxt_buf_t *b; nxt_conn_t *c; nxt_work_queue_t *wq; nxt_event_engine_t *engine; @@ -56,19 +55,17 @@ nxt_conn_io_read(nxt_task_t *task, void *obj, void *data) if (c->socket.read_ready) { - b = c->read; - - if (c->peek == 0) { - n = c->io->recvbuf(c, b); + if (state->io_read_handler == NULL) { + n = c->io->recvbuf(c, c->read); } else { - n = c->io->recv(c, b->mem.free, c->peek, MSG_PEEK); + n = state->io_read_handler(c); } if (n > 0) { c->nbytes = n; - nxt_recvbuf_update(b, n); + nxt_recvbuf_update(c->read, n); nxt_fd_event_block_read(engine, &c->socket); |