while (--loop_max) // Should only loop on cases of ERESTART or EINTR
{
int number_of;
- if ((number_of = poll(fds, 1, server->root->connect_timeout)) == -1) {
+ if ((number_of = poll(fds, 1, server->root->connect_timeout)) == SOCKET_ERROR) {
int local_errno = get_socket_errno(); // We cache in case closesocket() modifies errno
switch (local_errno) {
#ifdef __linux__
}
if (number_of == 0) {
- if (connection_error == EINPROGRESS) {
+ if (connection_error != EALREADY) {
int err;
socklen_t len = sizeof(err);
if (getsockopt(server->fd, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == -1) {
}
assert(fds[0].revents & POLLOUT);
- if (fds[0].revents & POLLOUT and connection_error == EINPROGRESS) {
+ if (fds[0].revents & POLLOUT and connection_error != EALREADY) {
int err;
socklen_t len = sizeof(err);
if (getsockopt(server->fd, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == -1) {
#if EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
+ case EAGAIN:
case EINPROGRESS: // nonblocking mode - first return
case EALREADY: // nonblocking mode - subsequent returns
{