aboutsummaryrefslogtreecommitdiffstats
path: root/src/interface.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-03-12 22:38:49 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-03-12 22:38:49 +0000
commitaa7b69808626e2d8ff17678fd1d0dc6d1e03ba5a (patch)
tree6cf38f5e7d3886ca219ea59fb5df7874c6724f87 /src/interface.c
parent41b5fedaf0cc6b4070dcc0d5a261aaa005dadddf (diff)
downloadmpd-aa7b69808626e2d8ff17678fd1d0dc6d1e03ba5a.tar.gz
mpd-aa7b69808626e2d8ff17678fd1d0dc6d1e03ba5a.tar.xz
mpd-aa7b69808626e2d8ff17678fd1d0dc6d1e03ba5a.zip
*) slight code cleanup
*) now --kill will not check for /proc/<pid>/exe (this is linux specific) git-svn-id: https://svn.musicpd.org/mpd/trunk@3063 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/interface.c')
-rw-r--r--src/interface.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/interface.c b/src/interface.c
index fd33382e8..fac7af771 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -393,21 +393,28 @@ int doIOForInterfaces() {
struct timeval tv;
int i;
int selret;
- int fdmax = 0;
+ int fdmax;
tv.tv_sec = 1;
tv.tv_usec = 0;
- addInterfacesReadyToReadAndListenSocketToFdSet(&rfds,&fdmax);
- addInterfacesForBufferFlushToFdSet(&wfds,&fdmax);
+ while(1) {
+ fdmax = 0;
- while((selret = select(fdmax+1,&rfds,&wfds,NULL,&tv))) {
- getConnections(&rfds);
- if(selret<0 && errno==EINTR) break;
- else if(selret<0) {
+ addInterfacesReadyToReadAndListenSocketToFdSet(&rfds,&fdmax);
+ addInterfacesForBufferFlushToFdSet(&wfds,&fdmax);
+
+ selret = select(fdmax+1,&rfds,&wfds,NULL,&tv);
+
+ if(selret == 0 || (selret<0 && errno==EINTR)) break;
+
+ if(selret<0) {
closeNextErroredInterface();
continue;
}
+
+ getConnections(&rfds);
+
for(i=0;i<interface_max_connections;i++) {
if(interfaces[i].open && FD_ISSET(interfaces[i].fd,&rfds)) {
if(COMMAND_RETURN_KILL==interfaceReadInput(&(interfaces[i]))) {
@@ -420,11 +427,9 @@ int doIOForInterfaces() {
interfaces[i].lastTime = time(NULL);
}
}
+
tv.tv_sec = 0;
tv.tv_usec = 0;
- fdmax = 0;
- addInterfacesReadyToReadAndListenSocketToFdSet(&rfds,&fdmax);
- addInterfacesForBufferFlushToFdSet(&wfds,&fdmax);
}
return 1;