Rework para_accept().
[paraslash.git] / server.c
index edd382711d0c058e41f7a731a38e8c47cab0883a..2afb6db58de95906ba9bbd19f52a79ce054ae59d 100644 (file)
--- a/server.c
+++ b/server.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1997-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997-2010 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -16,7 +16,7 @@
  *     - The main programs: \ref server.c, \ref audiod.c, \ref client.c,
  *       \ref audioc.c, \ref afh.c
  *     - Server: \ref server_command, \ref sender,
- *     - Audio file selector: \ref audio_format_handler, \ref mood, \ref afs_table,
+ *     - Audio file selector: \ref audio_format_handler, \ref afs_table,
  *     - Client: \ref receiver, \ref receiver_node, \ref filter, \ref filter_node.
  *
  *
@@ -366,12 +366,9 @@ static void command_post_select(struct sched *s, struct task *t)
        pid_t child_pid;
        uint32_t *chunk_table;
 
-       if (!FD_ISSET(sct->listen_fd, &s->rfds))
-               return;
-       ret = para_accept(sct->listen_fd, NULL, 0);
-       if (ret < 0)
+       ret = para_accept(sct->listen_fd, &s->rfds, NULL, 0, &new_fd);
+       if (ret <= 0)
                goto out;
-       new_fd = ret;
        peer_name = remote_name(new_fd);
        PARA_INFO_LOG("got connection from %s, forking\n", peer_name);
        mmd->num_connects++;
@@ -425,7 +422,7 @@ static void init_server_command_task(int argc, char **argv)
        sct->task.post_select = command_post_select;
        sct->argc = argc;
        sct->argv = argv;
-       ret = para_listen(AF_UNSPEC, IPPROTO_TCP, conf.port_arg);
+       ret = para_listen_simple(IPPROTO_TCP, conf.port_arg);
        if (ret < 0)
                goto err;
        sct->listen_fd = ret;