diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-23 19:56:03 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-23 19:56:03 +0300 |
commit | de532922d9ab42aa15b40d47c8db53ac2af38500 (patch) | |
tree | d6b7c6b21c7a6e0e3620a3e0c7198e63454d05e3 /src/nxt_socketpair.c | |
parent | 16cbf3c076a0aca6d47adaf3f719493674cf2363 (diff) | |
download | unit-de532922d9ab42aa15b40d47c8db53ac2af38500.tar.gz unit-de532922d9ab42aa15b40d47c8db53ac2af38500.tar.bz2 |
Introducing tasks.
Diffstat (limited to 'src/nxt_socketpair.c')
-rw-r--r-- | src/nxt_socketpair.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/nxt_socketpair.c b/src/nxt_socketpair.c index 20336d38..4a7cbbaa 100644 --- a/src/nxt_socketpair.c +++ b/src/nxt_socketpair.c @@ -82,8 +82,7 @@ nxt_socketpair_send(nxt_event_fd_t *ev, nxt_fd_t fd, nxt_iobuf_t *iob, err = (n == -1) ? nxt_socket_errno : 0; - nxt_log_debug(ev->log, "sendmsg(%d, %FD, %ui): %z", - ev->fd, fd, niob, n); + nxt_debug(ev->task, "sendmsg(%d, %FD, %ui): %z", ev->fd, fd, niob, n); if (n > 0) { return n; @@ -94,18 +93,19 @@ nxt_socketpair_send(nxt_event_fd_t *ev, nxt_fd_t fd, nxt_iobuf_t *iob, switch (err) { case NXT_EAGAIN: - nxt_log_debug(ev->log, "sendmsg(%d) not ready", ev->fd); + nxt_debug(ev->task, "sendmsg(%d) not ready", ev->fd); ev->write_ready = 0; + return NXT_AGAIN; case NXT_EINTR: - nxt_log_debug(ev->log, "sendmsg(%d) interrupted", ev->fd); + nxt_debug(ev->task, "sendmsg(%d) interrupted", ev->fd); continue; default: - nxt_log_error(NXT_LOG_CRIT, ev->log, - "sendmsg(%d, %FD, %ui) failed %E", - ev->fd, fd, niob, err); + nxt_log(ev->task, NXT_LOG_CRIT, "sendmsg(%d, %FD, %ui) failed %E", + ev->fd, fd, niob, err); + return NXT_ERROR; } } @@ -124,8 +124,7 @@ nxt_socketpair_recv(nxt_event_fd_t *ev, nxt_fd_t *fd, nxt_iobuf_t *iob, err = (n == -1) ? nxt_socket_errno : 0; - nxt_log_debug(ev->log, "recvmsg(%d, %FD, %ui): %z", - ev->fd, *fd, niob, n); + nxt_debug(ev->task, "recvmsg(%d, %FD, %ui): %z", ev->fd, *fd, niob, n); if (n > 0) { return n; @@ -134,6 +133,7 @@ nxt_socketpair_recv(nxt_event_fd_t *ev, nxt_fd_t *fd, nxt_iobuf_t *iob, if (n == 0) { ev->closed = 1; ev->read_ready = 0; + return n; } @@ -142,18 +142,19 @@ nxt_socketpair_recv(nxt_event_fd_t *ev, nxt_fd_t *fd, nxt_iobuf_t *iob, switch (err) { case NXT_EAGAIN: - nxt_log_debug(ev->log, "recvmsg(%d) not ready", ev->fd); + nxt_debug(ev->task, "recvmsg(%d) not ready", ev->fd); ev->read_ready = 0; + return NXT_AGAIN; case NXT_EINTR: - nxt_log_debug(ev->log, "recvmsg(%d) interrupted", ev->fd); + nxt_debug(ev->task, "recvmsg(%d) interrupted", ev->fd); continue; default: - nxt_log_error(NXT_LOG_CRIT, ev->log, - "recvmsg(%d, %p, %ui) failed %E", - ev->fd, fd, niob, err); + nxt_log(ev->task, NXT_LOG_CRIT, "recvmsg(%d, %p, %ui) failed %E", + ev->fd, fd, niob, err); + return NXT_ERROR; } } |