Handling ENOBUFS error same was as EAGAIN.

Unlike EAGAIN, ENOBUFS returned on OSX when trying to send many relatively
small (64 bytes) fragments.

Found during investigation of #167 issue on GitHub.
This commit is contained in:
Max Romanov
2019-03-05 15:38:49 +03:00
parent aedb999fe1
commit 0ab83370cb
2 changed files with 12 additions and 2 deletions

View File

@@ -45,6 +45,7 @@ typedef int nxt_err_t;
#define NXT_EILSEQ EILSEQ
#define NXT_ETIME ETIME
#define NXT_ENOMOREFILES 0
#define NXT_ENOBUFS ENOBUFS
#if (NXT_HPUX)
/* HP-UX uses EWOULDBLOCK instead of EAGAIN. */

View File

@@ -94,9 +94,14 @@ nxt_socketpair_send(nxt_fd_event_t *ev, nxt_fd_t fd, nxt_iobuf_t *iob,
case NXT_EAGAIN:
nxt_debug(ev->task, "sendmsg(%d) not ready", ev->fd);
ev->write_ready = 0;
break;
return NXT_AGAIN;
/*
* Returned (at least on OSX) when trying to send many small messages.
*/
case NXT_ENOBUFS:
nxt_debug(ev->task, "sendmsg(%d) no buffers", ev->fd);
break;
case NXT_EINTR:
nxt_debug(ev->task, "sendmsg(%d) interrupted", ev->fd);
@@ -108,6 +113,10 @@ nxt_socketpair_send(nxt_fd_event_t *ev, nxt_fd_t fd, nxt_iobuf_t *iob,
return NXT_ERROR;
}
ev->write_ready = 0;
return NXT_AGAIN;
}
}