audioc.c, audiod.c, server.c: use para_fd_set()
authorAndre <maan@p133.(none)>
Wed, 19 Apr 2006 03:22:14 +0000 (05:22 +0200)
committerAndre <maan@p133.(none)>
Wed, 19 Apr 2006 03:22:14 +0000 (05:22 +0200)
audioc.c
audiod.c
server.c

index b9e7853..7d472a6 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -119,13 +119,10 @@ int main(int argc, char *argv[])
                FD_ZERO(&wfd);
                if (loaded && loaded > 10000)
                        fprintf(stderr, "loaded: %d\n", loaded);
-               if (loaded < conf.bufsize_arg) {
-                       FD_SET(fd, &rfd);
-                       max_fileno = PARA_MAX(max_fileno, fd);
-               }
+               if (loaded < conf.bufsize_arg)
+                       para_fd_set(fd, &rfd, &max_fileno);
                if (loaded > 0) {
-                       FD_SET(STDOUT_FILENO, &wfd);
-                       max_fileno = PARA_MAX(max_fileno, STDOUT_FILENO);
+                       para_fd_set(STDOUT_FILENO, &wfd, &max_fileno);
                        check_write = 1;
                }
                ret = -E_OVERRUN;
index 912b2db..61711dc 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1562,8 +1562,7 @@ repeat:
        FD_ZERO(&wfds);
        FD_ZERO(&rfds);
        /* always check signal pipe and the local socket */
-       FD_SET(signal_pipe, &rfds);
-       max_fileno = signal_pipe;
+       para_fd_set(signal_pipe, &rfds, &max_fileno);
        para_fd_set(audiod_socket, &rfds, &max_fileno);
 
        if (audiod_status != AUDIOD_ON)
index e10c1e0..6f70d97 100644 (file)
--- a/server.c
+++ b/server.c
@@ -63,6 +63,7 @@ extern void http_send_init(struct sender *);
 extern void ortp_send_init(struct sender *);
 extern struct audio_format afl[];
 
+/* TODO: This is better handled by autoconf */
 /** the list of supported audio file selectors */
 struct audio_file_selector selectors[] = {
        {
@@ -436,14 +437,12 @@ int main(int argc, char *argv[])
        valid_fd_012();
        sockfd = do_inits(argc, argv);
 repeat:
-       /* check socket and signal pipe in any case */
        FD_ZERO(&rfds);
        FD_ZERO(&wfds);
-       FD_SET(sockfd, &rfds);
-       max_fileno = sockfd;
-       FD_SET(signal_pipe, &rfds);
-       max_fileno = PARA_MAX(max_fileno, signal_pipe);
-
+       max_fileno = -1;
+       /* check socket and signal pipe in any case */
+       para_fd_set(sockfd, &rfds, &max_fileno);
+       para_fd_set(signal_pipe, &rfds, &max_fileno);
        timeout = afs_preselect();
        status_refresh();
        for (i = 0; senders[i].name; i++) {