From 35e195aba3d4304e383bdd5d1216a39994b60d44 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 15 May 2012 11:30:22 +0200 Subject: pulse: don' try to reconnect immediately if PA is dying https://bugs.freedesktop.org/show_bug.cgi?id=35024 --- src/pulse.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pulse.c b/src/pulse.c index d4225d1..e28a517 100644 --- a/src/pulse.c +++ b/src/pulse.c @@ -225,6 +225,9 @@ static int context_connect(ca_context *c, ca_bool_t nofail) { ca_return_val_if_fail(p->mainloop, CA_ERROR_STATE); ca_return_val_if_fail(!p->context, CA_ERROR_STATE); + /* If this immediate attempt fails, don't try to reconnect. */ + p->reconnect = FALSE; + if ((ret = convert_proplist(&l, c->props)) < 0) return ret; @@ -317,7 +320,11 @@ static void context_state_cb(pa_context *pc, void *userdata) { * reconnect, and pass NOFAIL */ context_connect(c, TRUE); } - } + + } else if (state == PA_CONTEXT_READY) + /* OK, the connection suceeded once, if it dies now try to + * reconnect */ + p->reconnect = TRUE; pa_threaded_mainloop_signal(p->mainloop, FALSE); } @@ -429,10 +436,6 @@ int driver_open(ca_context *c) { pa_threaded_mainloop_wait(p->mainloop); } - /* OK, the connection suceeded once, if it dies now try to - * reconnect */ - p->reconnect = TRUE; - pa_threaded_mainloop_unlock(p->mainloop); return CA_SUCCESS; -- cgit