mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
handle error returned from listening sockets, can cause busy looping
svn path=/trunk/icecast/; revision=4986
This commit is contained in:
parent
784fe52e85
commit
f2e1bc2419
@ -145,11 +145,31 @@ static int wait_for_serversock(int timeout)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
int dst;
|
||||||
for(i=0; i < global.server_sockets; i++) {
|
for(i=0; i < global.server_sockets; i++) {
|
||||||
if(ufds[i].revents == POLLIN)
|
if(ufds[i].revents & POLLIN)
|
||||||
return ufds[i].fd;
|
return ufds[i].fd;
|
||||||
|
if(ufds[i].revents & (POLLHUP|POLLERR|POLLNVAL))
|
||||||
|
{
|
||||||
|
if (ufds[i].revents & (POLLHUP|POLLERR))
|
||||||
|
{
|
||||||
|
close (global.serversock[i]);
|
||||||
|
WARN0("Had to close a listening socket");
|
||||||
}
|
}
|
||||||
return -1; /* Shouldn't happen */
|
global.serversock[i] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* remove any closed sockets */
|
||||||
|
for(i=0, dst=0; i < global.server_sockets; i++)
|
||||||
|
{
|
||||||
|
if (global.serversock[i] == -1)
|
||||||
|
continue;
|
||||||
|
if (i!=dst)
|
||||||
|
global.serversock[dst] = global.serversock[i];
|
||||||
|
dst++;
|
||||||
|
}
|
||||||
|
global.server_sockets = dst;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
|
Loading…
Reference in New Issue
Block a user