From: Andre Noll Date: Sun, 10 May 2009 12:11:38 +0000 (+0200) Subject: audiod: Properly handle wng open failures. X-Git-Tag: v0.3.5~57 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=f87868b3147b189b6d4ee4e44817f092bd1c2895;p=paraslash.git audiod: Properly handle wng open failures. If opening the writer node group fails, no task is being registered to the scheduler although a task structure is allocated. This makes audiod think everything is fine until the output buffer of the receiver or a filter is filled up which may take several seconds. Fix this flaw by setting the error field of the wng to -E_TASK_UNREGISTERED. This causes audiod to close the receiver node and the filter chain and to clear the affected slot. --- diff --git a/audiod.c b/audiod.c index 77819654..ce5bc551 100644 --- a/audiod.c +++ b/audiod.c @@ -437,10 +437,8 @@ static void open_writers(int slot_num) s->wng->writer_nodes[i].writer = a->writers[i]; } ret = wng_open(s->wng); - if (ret < 0) { - PARA_ERROR_LOG("%s\n", para_strerror(-ret)); + if (ret < 0) return; - } s->wstime = *now; s->server_stream_start = stat_task->server_stream_start.tv_sec? stat_task->server_stream_start : *now; diff --git a/write_common.c b/write_common.c index b684661b..4619d407 100644 --- a/write_common.c +++ b/write_common.c @@ -99,7 +99,9 @@ err_out: struct writer_node *wn = &g->writer_nodes[--i]; wn->writer->close(wn); } + free(g->writer_nodes); g->num_writers = 0; + g->task.error = -E_TASK_UNREGISTERED; return ret; }