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.
This commit is contained in:
Max Kellermann 2021-05-21 15:01:26 +02:00 committed by Max Kellermann
parent b394d8d059
commit 1c4b484a56

View File

@ -19,7 +19,7 @@
#include "Poll.hxx" #include "Poll.hxx"
#include "event/SocketEvent.hxx" #include "event/SocketEvent.hxx"
#include "event/CoarseTimerEvent.hxx" #include "event/FineTimerEvent.hxx"
#include "time/Convert.hxx" #include "time/Convert.hxx"
static constexpr unsigned static constexpr unsigned
@ -78,7 +78,11 @@ private:
}; };
struct AvahiTimeout final { 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; const AvahiTimeoutCallback callback;
void *const userdata; void *const userdata;