Merge branch 'refs/heads/t/abtract_sockets'
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index 65d6ed9..c5e2c93 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -28,8 +28,8 @@
 #include "ipc.h"
 #include "list.h"
 #include "sched.h"
 #include "ipc.h"
 #include "list.h"
 #include "sched.h"
-#include "signal.h"
 #include "fd.h"
 #include "fd.h"
+#include "signal.h"
 #include "mood.h"
 #include "sideband.h"
 #include "command.h"
 #include "mood.h"
 #include "sideband.h"
 #include "command.h"
@@ -89,7 +89,7 @@ extern struct misc_meta_data *mmd;
 
 static int server_socket;
 static struct command_task command_task_struct;
 
 static int server_socket;
 static struct command_task command_task_struct;
-static struct signal_task signal_task_struct;
+static struct signal_task *signal_task;
 
 static enum play_mode current_play_mode;
 static char *current_mop; /* mode or playlist specifier. NULL means dummy mood */
 
 static enum play_mode current_play_mode;
 static char *current_mop; /* mode or playlist specifier. NULL means dummy mood */
@@ -713,12 +713,6 @@ static int open_afs_tables(void)
        return ret;
 }
 
        return ret;
 }
 
-static void signal_pre_select(struct sched *s, void *context)
-{
-       struct signal_task *st = context;
-       para_fd_set(st->fd, &s->rfds, &s->max_fileno);
-}
-
 static int afs_signal_post_select(struct sched *s, __a_unused void *context)
 {
        int signum, ret;
 static int afs_signal_post_select(struct sched *s, __a_unused void *context)
 {
        int signum, ret;
@@ -747,20 +741,17 @@ shutdown:
 
 static void register_signal_task(struct sched *s)
 {
 
 static void register_signal_task(struct sched *s)
 {
-       struct signal_task *st = &signal_task_struct;
-
        para_sigaction(SIGPIPE, SIG_IGN);
        para_sigaction(SIGPIPE, SIG_IGN);
-       st->fd = para_signal_init();
-       PARA_INFO_LOG("signal pipe: fd %d\n", st->fd);
+       signal_task = signal_init_or_die();
        para_install_sighandler(SIGINT);
        para_install_sighandler(SIGTERM);
        para_install_sighandler(SIGHUP);
 
        para_install_sighandler(SIGINT);
        para_install_sighandler(SIGTERM);
        para_install_sighandler(SIGHUP);
 
-       st->task = task_register(&(struct task_info) {
+       signal_task->task = task_register(&(struct task_info) {
                .name = "signal",
                .pre_select = signal_pre_select,
                .post_select = afs_signal_post_select,
                .name = "signal",
                .pre_select = signal_pre_select,
                .post_select = afs_signal_post_select,
-               .context = st,
+               .context = signal_task,
 
        }, s);
 }
 
        }, s);
 }