- assert_msg(ptr->fd != INVALID_SOCKET, "poll() was passed an invalid file descriptor");
- (void)closesocket(ptr->fd);
- ptr->fd= INVALID_SOCKET;
- ptr->state= MEMCACHED_SERVER_STATE_NEW;
+ // We check the value to see what happened with the socket.
+ if (err == 0) // Should not happen
+ {
+ return MEMCACHED_SUCCESS;
+ }
+ errno= err;
+
+ return memcached_set_errno(*server, err, MEMCACHED_AT, memcached_literal_param("getsockopt() found the error from poll() during connect."));
+ }
+ assert(fds[0].revents & POLLOUT);
+
+ if (fds[0].revents & POLLOUT and connection_error == EINPROGRESS)
+ {
+ int err;
+ socklen_t len= sizeof(err);
+ if (getsockopt(server->fd, SOL_SOCKET, SO_ERROR, (char*)&err, &len) == -1)
+ {
+ return memcached_set_errno(*server, errno, MEMCACHED_AT);
+ }