]> git.tue.mpg.de Git - paraslash.git/commitdiff
audiod: Properly handle wng open failures.
authorAndre Noll <maan@systemlinux.org>
Sun, 10 May 2009 12:11:38 +0000 (14:11 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 10 May 2009 12:11:38 +0000 (14:11 +0200)
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.

audiod.c
write_common.c

index 778196542d63dc855a6c8ccd6228362b434b698f..ce5bc551f8767349a41fe0974f52fa1975d2a1f8 100644 (file)
--- 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;
index b684661b4aa04ccdfd736b6319bf857c74080498..4619d40702338901d3437a4989afaf54889e334d 100644 (file)
@@ -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;
 }