/*
- * Copyright (C) 1997-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997-2011 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
* 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,
*
* - Doubly linked lists: \ref list.h,
* - Ring buffer: \ref ringbuffer.c, \ref ringbuffer.h,
- * - Hashing: \ref hash.h, \ref sha1.h, \ref sha1.c,
- * - Crypto: \ref crypt.c.
+ * - Crypto: \ref crypt.c, \ref crypt.h.
* - Forward error correction: \ref fec.c.
*/
#include <signal.h>
-#include <dirent.h>
#include <sys/time.h>
-#include <openssl/rc4.h>
#include <regex.h>
#include <osl.h>
+#include <stdbool.h>
#include "para.h"
#include "error.h"
#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"
#include "signal.h"
#include "user_list.h"
#include "color.h"
+#include "version.h"
/** Define the array of error lists needed by para_server. */
INIT_SERVER_ERRLISTS;
static void init_colors_or_die(void)
{
- int ret, i;
+ int i;
if (!want_colors())
return;
daemon_set_flag(DF_COLOR_LOG);
daemon_set_default_log_colors();
- for (i = 0; i < conf.log_color_given; i++) {
- ret = daemon_set_log_color(conf.log_color_arg[i]);
- if (ret < 0)
- exit(EXIT_FAILURE);
- }
+ for (i = 0; i < conf.log_color_given; i++)
+ daemon_set_log_color_or_die(conf.log_color_arg[i]);
}
/*
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;
/* 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.
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++;
if (ret < 0)
goto err;
add_close_on_fork_list(sct->listen_fd); /* child doesn't need the listener */
+ sprintf(sct->task.status, "server command task");
register_task(&sct->task);
return;
err: