}
}
if (i == httpd->max_connections) {
+ /* This code should never be reached, we do not select server_fd when full */
logger_log(httpd->logger, LOGGER_INFO, "Max connections reached");
shutdown(fd, SHUT_RDWR);
closesocket(fd);
}
httpd->server_fd = netutils_init_socket(port, 1, 0);
+ if (httpd->server_fd == -1) {
+ logger_log(httpd->logger, LOGGER_INFO, "Error initialising IPv6 socket %d", SOCKET_GET_ERROR());
+ logger_log(httpd->logger, LOGGER_INFO, "Attempting to fall back to IPv4");
+ httpd->server_fd = netutils_init_socket(port, 0, 0);
+ }
if (httpd->server_fd == -1) {
logger_log(httpd->logger, LOGGER_INFO, "Error initialising socket %d", SOCKET_GET_ERROR());
MUTEX_UNLOCK(httpd->run_mutex);