don't assume that pa_asyncq_new() always succeeds

Bug 96741 shows a case where an assertion is hit, because
pa_asyncq_new() failed due to running out of file descriptors.
pa_asyncq_new() is used in only one place (not counting the call in
asyncq-test): pa_asyncmsgq_new(). Now pa_asyncmsgq_new() can fail too,
which requires error handling in many places. One of those places is
pa_thread_mq_init(), which can now fail too, and that needs additional
error handling in many more places. Luckily there weren't any places
where adding better error handling wouldn't have been easy, so there are
many changes in this patch, but they are not complicated.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=96741
This commit is contained in:
Tanu Kaskinen 2016-09-13 18:43:38 +03:00
parent 3e52972c61
commit 60695e3d84
27 changed files with 205 additions and 32 deletions

View file

@ -1968,7 +1968,11 @@ int pa__init(pa_module*m) {
u->counter = u->counter_delta = 0;
u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
if (pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll) < 0) {
pa_log("pa_thread_mq_init() failed.");
goto fail;
}
if (pa_modargs_get_value_boolean(ma, "auto", &automatic) < 0) {
pa_log("Failed to parse argument \"auto\".");