From 1c4b484a56011bcdb50d987498477f276f2dd42a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 21 May 2021 15:01:26 +0200 Subject: [PATCH] avahi/Poll: use FineTimerEvent in AvahiTimeout libavahi-client uses this one to schedule events immediately. However, CoarseTimerEvent may be called too late, and cause timeouts. --- src/zeroconf/avahi/Poll.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/zeroconf/avahi/Poll.cxx b/src/zeroconf/avahi/Poll.cxx index 1d0f39895..6f9931d25 100644 --- a/src/zeroconf/avahi/Poll.cxx +++ b/src/zeroconf/avahi/Poll.cxx @@ -19,7 +19,7 @@ #include "Poll.hxx" #include "event/SocketEvent.hxx" -#include "event/CoarseTimerEvent.hxx" +#include "event/FineTimerEvent.hxx" #include "time/Convert.hxx" static constexpr unsigned @@ -78,7 +78,11 @@ private: }; struct AvahiTimeout final { - CoarseTimerEvent event; + /* note: cannot use CoarseTimerEvent because libavahi-client + sometimes schedules events immediately, and + CoarseTimerEvent may delay the timer callback for too + long, causing timeouts */ + FineTimerEvent event; const AvahiTimeoutCallback callback; void *const userdata;