*/
static inline int unclean_errno(int err)
{
- if (err == EAGAIN || err == EINPROGRESS ||
+ if (err == EAGAIN || err == EWOULDBLOCK || err == EINPROGRESS ||
err == EISCONN || err == EALREADY)
return 0;
return err;
if (ret < 0) {
if (errno == EINTR)
continue;
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
fd_cant_recv(conn->handle.fd);
goto not_ready;
}
if (ret < 0) {
if (errno == EINTR)
continue;
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
fd_cant_recv(conn->handle.fd);
goto not_ready;
}
if (errno == EINTR) {
continue;
}
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
fd_cant_recv(conn->handle.fd);
goto not_ready;
}
ret = send(fd, buf, len, 0);
if (ret < 0) {
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
struct ist myist;
myist = ist2(buf, len);
return -1;
if ((ret = recv(fd, data, size, 0)) < 0) {
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
fd_cant_recv(fd);
return 0;
}
ret = send(fd, dns_msg_trash, len, 0);
if (ret < 0) {
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
fd_cant_send(fd);
goto out;
}
ret = poll(poll_events, fd - start, 0);
if (ret >= 0)
break;
- } while (errno == EAGAIN || errno == EINTR || errno == ENOMEM);
+ } while (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR || errno == ENOMEM);
if (ret)
ret = fd - start;
if (sent < 0) {
static char once;
- if (errno == EAGAIN)
+ if (errno == EAGAIN || errno == EWOULDBLOCK)
_HA_ATOMIC_INC(&dropped_logs);
else if (!once) {
once = 1; /* note: no need for atomic ops here */
if (ret < 0) {
if (errno == EINTR)
continue;
- if (errno == EAGAIN)
+ if (errno == EAGAIN || errno == EWOULDBLOCK)
fd_cant_recv(fd);
goto out;
}
if (ret == -1) {
if (errno == EINTR)
continue;
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
fd_cant_recv(fd);
return;
}
/* should normally not happen but if so, indicates that it's OK */
conn->flags &= ~CO_FL_WAIT_L4_CONN;
}
- else if (errno == EAGAIN || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
+ else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
char *msg;
- if (errno == EAGAIN || errno == EADDRNOTAVAIL) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRNOTAVAIL) {
msg = "no free ports";
conn->err_code = CO_ER_FREE_PORTS;
}
}
switch (errno) {
+#if defined(EWOULDBLOCK) && defined(EAGAIN) && EWOULDBLOCK != EAGAIN
+ case EWOULDBLOCK:
+#endif
case EAGAIN:
ret = CO_AC_DONE; /* nothing more to accept */
if (fdtab[l->rx.fd].state & (FD_POLL_HUP|FD_POLL_ERR)) {
/* should normally not happen but if so, indicates that it's OK */
conn->flags &= ~CO_FL_WAIT_L4_CONN;
}
- else if (errno == EAGAIN || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
+ else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
char *msg;
- if (errno == EAGAIN || errno == EADDRNOTAVAIL) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRNOTAVAIL) {
msg = "no free ports";
conn->err_code = CO_ER_FREE_PORTS;
}
else if (errno == EISCONN) {
conn->flags &= ~CO_FL_WAIT_L4_CONN;
}
- else if (errno == EAGAIN || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
+ else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
char *msg;
- if (errno == EAGAIN || errno == EADDRNOTAVAIL) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRNOTAVAIL) {
msg = "can't connect to destination unix socket, check backlog size on the server";
conn->err_code = CO_ER_FREE_PORTS;
}
do {
ret = recvfrom(fd, dgram_buf, max_sz, 0,
(struct sockaddr *)&saddr, &saddrlen);
- if (ret < 0 && errno == EAGAIN) {
+ if (ret < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
fd_cant_recv(fd);
goto out;
}
if (ret < try)
break;
}
- else if (ret == 0 || errno == EAGAIN || errno == ENOTCONN || errno == EINPROGRESS) {
+ else if (ret == 0 || errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOTCONN || errno == EINPROGRESS) {
/* TODO must be handle properly. It is justified for UDP ? */
ABORT_NOW();
}
if (ret == 0)
goto out_read0;
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
/* there are two reasons for EAGAIN :
* - nothing in the socket buffer (standard)
* - pipe is full
SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
if (ret <= 0) {
- if (ret == 0 || errno == EAGAIN) {
+ if (ret == 0 || errno == EAGAIN || errno == EWOULDBLOCK) {
fd_cant_send(conn->handle.fd);
break;
}
else if (ret == 0) {
goto read0;
}
- else if (errno == EAGAIN || errno == ENOTCONN) {
+ else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOTCONN) {
/* socket buffer exhausted */
fd_cant_recv(conn->handle.fd);
break;
if (!count)
fd_stop_send(conn->handle.fd);
}
- else if (ret == 0 || errno == EAGAIN || errno == ENOTCONN || errno == EINPROGRESS) {
+ else if (ret == 0 || errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOTCONN || errno == EINPROGRESS) {
/* nothing written, we need to poll for write first */
fd_cant_send(conn->handle.fd);
break;
sockaddr_free(&addr);
switch (errno) {
+#if defined(EWOULDBLOCK) && defined(EAGAIN) && EWOULDBLOCK != EAGAIN
+ case EWOULDBLOCK:
+#endif
case EAGAIN:
ret = CO_AC_DONE; /* nothing more to accept */
if (fdtab[l->rx.fd].state & (FD_POLL_HUP|FD_POLL_ERR)) {
goto shut;
if (len < 0) {
- if (errno == EAGAIN) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
/* connection not closed yet */
fd_cant_recv(fd);
break;
/* For SSL_ERROR_SYSCALL, make sure to clear the error
* stack before shutting down the connection for
* reading. */
- if (ret == SSL_ERROR_SYSCALL && (!errno || errno == EAGAIN))
+ if (ret == SSL_ERROR_SYSCALL && (!errno || errno == EAGAIN || errno == EWOULDBLOCK))
goto clear_ssl_error;
/* otherwise it's a real error */
goto out_error;