Commit adac7ebe authored by Karl Heyes's avatar Karl Heyes

if addresses come back as IPv4-mapped IPv6 then make it look like IPv4 or else

we'll get queries about the access log.  Fix a potential FD leak and add a
small delay into the listener thread if accept fails, the usual cause is an FD
limit being reached triggering logs to fill up and CPU to max out.


svn path=/icecast/trunk/icecast/; revision=13492
parent 916a4a4c
...@@ -266,18 +266,24 @@ static connection_t *_accept_connection(void) ...@@ -266,18 +266,24 @@ static connection_t *_accept_connection(void)
sock = sock_accept(serversock, ip, MAX_ADDR_LEN); sock = sock_accept(serversock, ip, MAX_ADDR_LEN);
if (sock >= 0) if (sock >= 0)
{ {
con = connection_create (sock, serversock, ip); /* Make any IPv4 mapped IPv6 address look like a normal IPv4 address */
if (con == NULL) if (strncmp (ip, "::ffff:", 7) == 0)
free (ip); memmove (ip, ip+7, strlen (ip+7)+1);
con = connection_create (sock, serversock, ip);
if (con)
return con; return con;
sock_close (sock);
} }
else
{
if (!sock_recoverable(sock_error())) if (!sock_recoverable(sock_error()))
{
WARN2("accept() failed with error %d: %s", sock_error(), strerror(sock_error())); WARN2("accept() failed with error %d: %s", sock_error(), strerror(sock_error()));
thread_sleep (500000);
}
}
free(ip); free(ip);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment