X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=afh_recv.c;h=6525209bff4119a177eb443f154b4f1f5224845b;hp=9d6effe1e25f6cc40ad0ccf5386ee997bce94862;hb=bab99bab677988723afe14a7d680e6d5cc7ddda4;hpb=764e71ceb1e188086c08e38dfd52d45b67dc15ba diff --git a/afh_recv.c b/afh_recv.c index 9d6effe1..6525209b 100644 --- a/afh_recv.c +++ b/afh_recv.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2011 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2011 Andre Noll , see file COPYING. */ /** \file afh_recv.c Receiver for streaming local files. */ @@ -72,7 +68,7 @@ static int afh_recv_open(struct receiver_node *rn) struct lls_parse_result *lpr = rn->lpr; struct private_afh_recv_data *pard; struct afh_info *afhi; - const char *fn = RECV_CMD_OPT_STRING_VAL(AFH, FILENAME, lpr); + const char *fn = RECV_CMD_OPT_STRING_VAL(AFH, FILENAME, lpr), *msg; int32_t bc = RECV_CMD_OPT_INT32_VAL(AFH, BEGIN_CHUNK, lpr); const struct lls_opt_result *r_e = RECV_CMD_OPT_RESULT(AFH, END_CHUNK, lpr); int ret; @@ -91,8 +87,10 @@ static int afh_recv_open(struct receiver_node *rn) goto out_unmap; pard->audio_format_num = ret; ret = -ERRNO_TO_PARA_ERROR(EINVAL); + msg = "no data chunks"; if (afhi->chunks_total == 0) goto out_clear_afhi; + msg = "invalid begin chunk"; if (PARA_ABS(bc) >= afhi->chunks_total) goto out_clear_afhi; if (bc >= 0) @@ -104,6 +102,7 @@ static int afh_recv_open(struct receiver_node *rn) if (lls_opt_given(r_e)) { int32_t ec = lls_int32_val(0, r_e); ret = -ERRNO_TO_PARA_ERROR(EINVAL); + msg = "invalid end chunk"; if (PARA_ABS(ec) > afhi->chunks_total) goto out_clear_afhi; if (ec >= 0) @@ -113,12 +112,14 @@ static int afh_recv_open(struct receiver_node *rn) } else pard->last_chunk = afhi->chunks_total - 1; ret = -ERRNO_TO_PARA_ERROR(EINVAL); + msg = "begin chunk >= end chunk!?"; if (pard->first_chunk >= pard->last_chunk) goto out_clear_afhi; pard->current_chunk = pard->first_chunk; return pard->audio_format_num; out_clear_afhi: clear_afhi(afhi); + PARA_ERROR_LOG("%s: %s\n", fn, msg); out_unmap: para_munmap(pard->map, pard->map_size); close(pard->fd); @@ -200,7 +201,7 @@ static int afh_recv_post_select(__a_unused struct sched *s, void *context) &pard->afh_context); if (ret < 0) goto out; - PARA_INFO_LOG("adding %zu bytes\n", size); + PARA_DEBUG_LOG("adding %zu bytes\n", size); btr_add_output_dont_free(start, size, btrn); } ret = -E_RECV_EOF; @@ -237,6 +238,7 @@ out: return ret; } +/** See \ref recv_init(). */ const struct receiver lsg_recv_cmd_com_afh_user_data = { .init = afh_init, .open = afh_recv_open,