Commit bce144a2 authored by Max Kellermann's avatar Max Kellermann

zeroconf/AvahiPoll: move code to Schedule()

parent 0cef84ca
...@@ -90,12 +90,12 @@ public: ...@@ -90,12 +90,12 @@ public:
:event(_loop, BIND_THIS_METHOD(OnTimeout)), :event(_loop, BIND_THIS_METHOD(OnTimeout)),
callback(_callback), userdata(_userdata) { callback(_callback), userdata(_userdata) {
if (tv != nullptr) if (tv != nullptr)
event.Schedule(ToSteadyClockDuration(*tv)); Schedule(*tv);
} }
static void TimeoutUpdate(AvahiTimeout *t, const struct timeval *tv) { static void TimeoutUpdate(AvahiTimeout *t, const struct timeval *tv) {
if (tv != nullptr) if (tv != nullptr)
t->event.Schedule(ToSteadyClockDuration(*tv)); t->Schedule(*tv);
else else
t->event.Cancel(); t->event.Cancel();
} }
...@@ -105,6 +105,10 @@ public: ...@@ -105,6 +105,10 @@ public:
} }
private: private:
void Schedule(const struct timeval &tv) noexcept {
event.Schedule(ToSteadyClockDuration(tv));
}
void OnTimeout() noexcept { void OnTimeout() noexcept {
callback(this, userdata); callback(this, userdata);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment