From bbbbf5f4bde1403b41785892de1eb08fed7ad65e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 25 Jul 2024 20:16:07 +0200 Subject: [PATCH] event/MultiSocketMonitor: reschedule epoll/EPERM workaround forever Fixes a regression by commit 3558317dc9c which caused the ALSA null plugin to cease to work because the workaround timer was never rescheduled. --- src/event/MultiSocketMonitor.cxx | 7 ++++++- src/event/MultiSocketMonitor.hxx | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/event/MultiSocketMonitor.cxx b/src/event/MultiSocketMonitor.cxx index 8f4921b14..81f072803 100644 --- a/src/event/MultiSocketMonitor.cxx +++ b/src/event/MultiSocketMonitor.cxx @@ -103,7 +103,7 @@ MultiSocketMonitor::Prepare() noexcept constexpr Event::Duration ready_timeout = std::chrono::milliseconds(1); if (timeout < timeout.zero() || timeout > ready_timeout) - timeout = ready_timeout; + timeout = always_ready_timeout = ready_timeout; } #endif @@ -120,6 +120,11 @@ MultiSocketMonitor::OnIdle() noexcept if (ready) { ready = false; DispatchSockets(); + +#ifdef USE_EPOLL + if (!refresh && !always_ready_fds.empty()) + timeout_event.Schedule(always_ready_timeout); +#endif } if (refresh) { diff --git a/src/event/MultiSocketMonitor.hxx b/src/event/MultiSocketMonitor.hxx index 68e4bd768..6b9c1ffad 100644 --- a/src/event/MultiSocketMonitor.hxx +++ b/src/event/MultiSocketMonitor.hxx @@ -109,6 +109,8 @@ class MultiSocketMonitor * epoll (epoll_ctl() returns -EPERM). */ std::forward_list always_ready_fds; + + Event::Duration always_ready_timeout; #endif protected: