-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.143 2017/06/04 14:37:05 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.145 2017/06/08 13:04:56 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
poll_fd[0].fd = fd;
poll_fd[0].events = POLLOUT;
- if (poll(poll_fd, 1, 30000) > 0)
+ retval = poll(poll_fd, 1, 30000);
+ if (retval == 0)
+ {
+ if (rp->ai_next != NULL)
+ {
+ /* Log this now as we'll try another address next */
+ log_error(LOG_LEVEL_CONNECT,
+ "Could not connect to [%s]:%s: Operation timed out.",
+ csp->http->host_ip_addr_str, service);
+ }
+ else
+ {
+ /*
+ * This is the last address, don't log this now
+ * as it would result in a duplicated log message.
+ */
+ socket_error = ETIMEDOUT;
+ }
+ }
+ else if (retval > 0)
#else
/* wait for connection to complete */
FD_ZERO(&wfds);
do
{
#if defined(FEATURE_ACCEPT_FILTER) && defined(SO_ACCEPTFILTER)
- struct accept_filter_arg af_options;
- bzero(&af_options, sizeof(af_options));
- strlcpy(af_options.af_name, "httpready", sizeof(af_options.af_name));
- setsockopt(fd, SOL_SOCKET, SO_ACCEPTFILTER, &af_options, sizeof(af_options));
+ if (csp->config->enable_accept_filter)
+ {
+ struct accept_filter_arg af_options;
+ bzero(&af_options, sizeof(af_options));
+ strlcpy(af_options.af_name, "httpready", sizeof(af_options.af_name));
+ if (setsockopt(fd, SOL_SOCKET, SO_ACCEPTFILTER, &af_options,
+ sizeof(af_options)))
+ {
+ log_error(LOG_LEVEL_ERROR,
+ "Enabling accept filter for socket %d failed: %E", fd);
+ }
+ }
#endif
afd = accept (fd, (struct sockaddr *) &client, &c_length);
} while (afd < 0 && errno == EINTR);