/* report error on POLL_ERR before connection establishment */
if ((fdtab[conn->handle.fd].state & FD_POLL_ERR) && (conn->flags & CO_FL_WAIT_L4_CONN)) {
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
+ conn_set_errcode(conn, CO_ER_POLLERR);
errno = 0; /* let the caller do a getsockopt() if it wants it */
goto leave;
}
}
/* here we have another error */
conn->flags |= CO_FL_ERROR;
+ conn_set_errno(conn, errno);
break;
} /* ret <= 0 */
/* it's already closed */
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH;
errno = EPIPE;
+ conn_set_errno(conn, errno);
return 0;
}
/* here we have another error */
conn->flags |= CO_FL_ERROR;
+ conn_set_errno(conn, errno);
break;
}
/* report error on POLL_ERR before connection establishment */
if ((fdtab[conn->handle.fd].state & FD_POLL_ERR) && (conn->flags & CO_FL_WAIT_L4_CONN)) {
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
+ conn_set_errcode(conn, CO_ER_POLLERR);
goto leave;
}
}
}
else if (errno != EINTR) {
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
+ conn_set_errno(conn, errno);
break;
}
}
* of recv()'s return value 0, so we have no way to tell there was
* an error without checking.
*/
- if (unlikely(!done && fdtab[conn->handle.fd].state & FD_POLL_ERR))
+ if (unlikely(!done && fdtab[conn->handle.fd].state & FD_POLL_ERR)) {
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
+ conn_set_errcode(conn, CO_ER_POLLERR);
+ }
goto leave;
}
if (unlikely(fdtab[conn->handle.fd].state & FD_POLL_ERR)) {
/* an error was reported on the FD, we can't send anymore */
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_WR_SH | CO_FL_SOCK_RD_SH;
+ conn_set_errcode(conn, CO_ER_POLLERR);
errno = EPIPE;
return 0;
}
/* it's already closed */
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH;
errno = EPIPE;
+ conn_set_errno(conn, errno);
return 0;
}
}
else if (errno != EINTR) {
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
+ conn_set_errno(conn, errno);
break;
}
}