diff options
author | Igor Sysoev <igor@sysoev.ru> | 2019-11-14 16:39:48 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2019-11-14 16:39:48 +0300 |
commit | 96cd6558ce35216fe8cfd7663c7af3345e64c8a8 (patch) | |
tree | 2aa7f05b01f344d59900083910952d41bfa3bc82 /src/nxt_epoll_engine.c | |
parent | 5452ee458d2c764569213266362fb636114adbc2 (diff) | |
download | unit-96cd6558ce35216fe8cfd7663c7af3345e64c8a8.tar.gz unit-96cd6558ce35216fe8cfd7663c7af3345e64c8a8.tar.bz2 |
Fixed connect(2) errors processing on old Linuxes.
While connect(2) states that non-blocking connect should use EPOLLOUT:
EINPROGRESS
The socket is non-blocking and the connection cannot be completed
immediately. It is possible to select(2) or poll(2) for completion by
selecting the socket for writing. After select(2) indicates writability,
use getsockopt(2) to read the SO_ERROR option at level SOL_SOCKET to
determine whether connect() completed successfully (SO_ERROR is zero)
or unsuccessfully (SO_ERROR is one of the usual error codes listed here,
explaining the reason for the failure).
On connect error, Linux 2.6.32 (CentOS 6) may return EPOLLRDHUP, EPOLLERR,
EPOLLHUP, EPOLLIN, but not EPOLLOUT.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_epoll_engine.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nxt_epoll_engine.c b/src/nxt_epoll_engine.c index 9cdaab9b..a944834e 100644 --- a/src/nxt_epoll_engine.c +++ b/src/nxt_epoll_engine.c @@ -944,12 +944,12 @@ nxt_epoll_poll(nxt_event_engine_t *engine, nxt_msec_t timeout) nxt_work_queue_add(ev->read_work_queue, ev->read_handler, ev->task, ev, ev->data); + error = 0; + } else if (engine->u.epoll.mode == 0) { /* Level-triggered mode. */ nxt_epoll_disable_read(engine, ev); } - - error = 0; } if ((events & EPOLLOUT) != 0) { @@ -964,12 +964,12 @@ nxt_epoll_poll(nxt_event_engine_t *engine, nxt_msec_t timeout) nxt_work_queue_add(ev->write_work_queue, ev->write_handler, ev->task, ev, ev->data); + error = 0; + } else if (engine->u.epoll.mode == 0) { /* Level-triggered mode. */ nxt_epoll_disable_write(engine, ev); } - - error = 0; } if (!error) { |