X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=server.c;h=11397d029f8fbff5413ed504ffb758a906eb69b4;hp=89a8137233c019df844f56d3a21bf841fd3fda15;hb=b15735ae7de59e0d9db43f23388d8ac47a6d2def;hpb=b0fe6d882dd35b01360a66e130d6714aff7b6a0d diff --git a/server.c b/server.c index 89a81372..11397d02 100644 --- a/server.c +++ b/server.c @@ -23,9 +23,9 @@ * The gory details, listed by topic: * * - Audio format handlers: \ref send_common.c \ref mp3_afh.c, - * \ref ogg_afh.c, \ref aac_afh.c, \ref wma_afh.c, + * \ref ogg_afh.c, \ref aac_afh.c, \ref wma_afh.c, \ref spx_afh.c * - Decoders: \ref mp3dec_filter.c, \ref oggdec_filter.c, - * \ref aacdec_filter.c, \ref wmadec_filter.c, + * \ref aacdec_filter.c, \ref wmadec_filter.c, spxdec_filter.c, * - Volume normalizer: \ref compress_filter.c, * - Output: \ref alsa_write.c, \ref osx_write.c, \ref oss_write.c, * - http: \ref http_recv.c, \ref http_send.c, @@ -68,6 +68,7 @@ #include #include #include +#include #include "para.h" #include "error.h" @@ -77,11 +78,11 @@ #include "string.h" #include "afs.h" #include "server.h" +#include "list.h" +#include "send.h" #include "vss.h" #include "config.h" #include "close_on_fork.h" -#include "list.h" -#include "send.h" #include "net.h" #include "daemon.h" #include "ipc.h" @@ -276,15 +277,13 @@ static void handle_sighup(void) kill(mmd->afs_pid, SIGHUP); } -static void signal_post_select(struct sched *s, struct task *t) +static void signal_post_select(struct sched *s, __a_unused struct task *t) { - struct signal_task *st = container_of(t, struct signal_task, task); + int signum = para_next_signal(&s->rfds); - if (!FD_ISSET(st->fd, &s->rfds)) + switch (signum) { + case 0: return; - - st->signum = para_next_signal(); - switch (st->signum) { case SIGHUP: handle_sighup(); break; @@ -304,7 +303,7 @@ static void signal_post_select(struct sched *s, struct task *t) /* die on sigint/sigterm. Kill all children too. */ case SIGINT: case SIGTERM: - PARA_EMERG_LOG("terminating on signal %d\n", st->signum); + PARA_EMERG_LOG("terminating on signal %d\n", signum); kill(0, SIGTERM); /* * We must wait for afs because afs catches SIGINT/SIGTERM. @@ -366,12 +365,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++;