X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=recv_common.c;h=31fd81f1ec52c3d0b6204e8b3663a7d36e14fbb3;hp=1ad84438026ce8f724ddf8d1fba8547a96276fb6;hb=HEAD;hpb=9498eb1c15c7e92c50675e7a951c0c0ea73cd93d diff --git a/recv_common.c b/recv_common.c index 1ad84438..1939300a 100644 --- a/recv_common.c +++ b/recv_common.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2006 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2006 Andre Noll , see file COPYING. */ /** \file recv_common.c common functions of para_recv and para_audiod */ @@ -19,27 +15,6 @@ #include "recv.h" #include "string.h" -/** - * Call the init function of each paraslash receiver. - * - * Receivers employ the user_data feature of the lopsub library: Each receiver - * of the recv_cmd suite defines a struct receiver as its user data. - * recv_init() obtains a pointer to this structure by calling lls_user_data(). - * If the receiver has an init function (i.e., if ->init is not NULL), ->init() - * is called to initialize the receiver. - */ -void recv_init(void) -{ - int i; - - FOR_EACH_RECEIVER(i) { - const struct lls_command *cmd = RECV_CMD(i); - const struct receiver *r = lls_user_data(cmd); - if (r && r->init) - r->init(); - } -} - /** * Check if the given string is a valid receiver specifier. * @@ -66,7 +41,7 @@ int check_receiver_arg(const char *ra, struct lls_parse_result **lprp) *lprp = NULL; if (!ra || !*ra) { argc = 1; - argv = para_malloc(2 * sizeof(char*)); + argv = alloc(2 * sizeof(char*)); argv[0] = para_strdup("http"); argv[1] = NULL; } else { @@ -123,19 +98,19 @@ void print_receiver_helps(bool detailed) } /** - * Simple pre-select hook, used by all receivers. + * Request a minimal timeout in case of buffer tree errors. * - * \param s Scheduler info. - * \param rn The receiver node. + * \param s The scheduler instance. + * \param rn The buffer tree node is derived from this. * - * This requests a minimal delay from the scheduler if the status of the buffer - * tree node indicates an error/eof condition. No file descriptors are added to - * the fd sets of \a s. + * If the buffer tree node of the given receiver node is in error or EOF state, + * a minimal I/O timeout is requested from the scheduler. Otherwise, the + * function does nothing. No file descriptors are asked to be monitored. * - * \return The status of the btr node of the receiver node, i.e. the return - * value of the underlying call to \ref btr_node_status(). + * \return The status of of the receiver node's buffer tree node. That is, the + * return value of the underlying call to \ref btr_node_status(). */ -int generic_recv_pre_select(struct sched *s, struct receiver_node *rn) +int generic_recv_pre_monitor(struct sched *s, struct receiver_node *rn) { int ret = btr_node_status(rn->btrn, 0, BTR_NT_ROOT);