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)
sock = sock_accept(serversock, ip, MAX_ADDR_LEN);
if (sock >= 0)
con = connection_create (sock, serversock, ip);
if (con == NULL)
free (ip);
/* Make any IPv4 mapped IPv6 address look like a normal IPv4 address */
if (strncmp (ip, "::ffff:", 7) == 0)
memmove (ip, ip+7, strlen (ip+7)+1);
con = connection_create (sock, serversock, ip);
if (con)
return con;
sock_close (sock);
if (!sock_recoverable(sock_error()))
WARN2("accept() failed with error %d: %s", sock_error(), strerror(sock_error()));
thread_sleep (500000);
return NULL;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment