Do not reconnect if connection was refused

Otherwise, it will try to reconnect recursively
This commit is contained in:
Neltharion
2026-04-29 03:40:06 +03:00
parent cca8dc38b6
commit a66d6b1596
+2
View File
@@ -99,6 +99,7 @@ void AudioBackend::contextStateCb(pa_context* c, void* data) {
nullptr, nullptr); nullptr, nullptr);
break; break;
case PA_CONTEXT_FAILED: case PA_CONTEXT_FAILED:
if (pa_context_errno(c) != PA_ERR_CONNECTIONREFUSED) {
// When pulseaudio server restarts, the connection is "failed". Try to reconnect. // When pulseaudio server restarts, the connection is "failed". Try to reconnect.
// pa_threaded_mainloop_lock is already acquired in callback threads. // pa_threaded_mainloop_lock is already acquired in callback threads.
// So there is no need to lock it again. // So there is no need to lock it again.
@@ -108,6 +109,7 @@ void AudioBackend::contextStateCb(pa_context* c, void* data) {
backend->context_ = nullptr; backend->context_ = nullptr;
} }
backend->connectContext(); backend->connectContext();
}
break; break;
case PA_CONTEXT_CONNECTING: case PA_CONTEXT_CONNECTING:
case PA_CONTEXT_AUTHORIZING: case PA_CONTEXT_AUTHORIZING: