diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-05-15 11:30:22 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-05-15 11:30:22 +0200 |
commit | 35e195aba3d4304e383bdd5d1216a39994b60d44 (patch) | |
tree | 8d6ab9694a9b26c8e8d369fdf50910bd1c914656 | |
parent | 47b2b723c8a266d2dd7dfd5d6686588b0ac1f2b0 (diff) |
pulse: don' try to reconnect immediately if PA is dying
https://bugs.freedesktop.org/show_bug.cgi?id=35024
-rw-r--r-- | src/pulse.c | 13 |
1 files 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; |