X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=afs.c;h=3da39f324b83b2a6d83d1f468732f74cc4313ae2;hb=be5daec66f163725489f42d512659a8af5c3fd59;hp=febe13b3e7c561cf2082ab9200c6578806ab8026;hpb=e3a7e12639c34fd86d48a072beb48add8c498d09;p=paraslash.git diff --git a/afs.c b/afs.c index febe13b3..3da39f32 100644 --- a/afs.c +++ b/afs.c @@ -24,6 +24,7 @@ #include "afs.h" #include "net.h" #include "server.h" +#include "daemon.h" #include "ipc.h" #include "list.h" #include "sched.h" @@ -959,7 +960,7 @@ static int command_post_monitor(struct sched *s, void *context) close(fd); return 0; } - client = para_malloc(sizeof(*client)); + client = alloc(sizeof(*client)); client->fd = fd; client->connect_time = *now; para_list_add(&client->node, &afs_client_list); @@ -979,6 +980,14 @@ static void register_command_task(struct sched *s) }, s); } +static int afs_poll(struct pollfd *fds, nfds_t nfds, int timeout) +{ + mutex_lock(mmd_mutex); + daemon_set_loglevel(mmd->loglevel); + mutex_unlock(mmd_mutex); + return xpoll(fds, nfds, timeout); +} + /** * Initialize the audio file selector process. * @@ -1004,6 +1013,7 @@ __noreturn void afs_init(int socket_fd) init_admissible_files(OPT_STRING_VAL(AFS_INITIAL_MODE)); register_command_task(&s); s.default_timeout = 1000; + s.poll_function = afs_poll; ret = write(socket_fd, "\0", 1); if (ret != 1) { if (ret == 0)