zeroconf/avahi/Poll: make EventLoop the first parameter

This commit is contained in:
Max Kellermann 2021-02-22 14:51:46 +01:00
parent f29c69d6a9
commit 0405a57f26

View File

@ -47,9 +47,9 @@ struct AvahiWatch final {
AvahiWatchEvent received; AvahiWatchEvent received;
public: public:
AvahiWatch(SocketDescriptor _fd, AvahiWatchEvent _event, AvahiWatch(EventLoop &_loop,
AvahiWatchCallback _callback, void *_userdata, SocketDescriptor _fd, AvahiWatchEvent _event,
EventLoop &_loop) noexcept AvahiWatchCallback _callback, void *_userdata) noexcept
:event(_loop, BIND_THIS_METHOD(OnSocketReady), _fd), :event(_loop, BIND_THIS_METHOD(OnSocketReady), _fd),
callback(_callback), userdata(_userdata), callback(_callback), userdata(_userdata),
received(AvahiWatchEvent(0)) { received(AvahiWatchEvent(0)) {
@ -84,9 +84,8 @@ struct AvahiTimeout final {
void *const userdata; void *const userdata;
public: public:
AvahiTimeout(const struct timeval *tv, AvahiTimeout(EventLoop &_loop, const struct timeval *tv,
AvahiTimeoutCallback _callback, void *_userdata, AvahiTimeoutCallback _callback, void *_userdata) noexcept
EventLoop &_loop) noexcept
: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)
@ -129,8 +128,8 @@ MyAvahiPoll::WatchNew(const AvahiPoll *api, int fd, AvahiWatchEvent event,
{ {
const MyAvahiPoll &poll = *(const MyAvahiPoll *)api; const MyAvahiPoll &poll = *(const MyAvahiPoll *)api;
return new AvahiWatch(SocketDescriptor(fd), event, callback, userdata, return new AvahiWatch(poll.event_loop, SocketDescriptor(fd), event,
poll.event_loop); callback, userdata);
} }
AvahiTimeout * AvahiTimeout *
@ -139,6 +138,5 @@ MyAvahiPoll::TimeoutNew(const AvahiPoll *api, const struct timeval *tv,
{ {
const MyAvahiPoll &poll = *(const MyAvahiPoll *)api; const MyAvahiPoll &poll = *(const MyAvahiPoll *)api;
return new AvahiTimeout(tv, callback, userdata, return new AvahiTimeout(poll.event_loop, tv, callback, userdata);
poll.event_loop);
} }