diff --git a/src/event/SocketEvent.cxx b/src/event/SocketEvent.cxx index a4e507043..98313a6b0 100644 --- a/src/event/SocketEvent.cxx +++ b/src/event/SocketEvent.cxx @@ -60,6 +60,9 @@ SocketEvent::Abandon() noexcept bool SocketEvent::Schedule(unsigned flags) noexcept { + if (flags != 0) + flags |= IMPLICIT_FLAGS; + if (flags == GetScheduledFlags()) return true; @@ -94,21 +97,11 @@ SocketEvent::Schedule(unsigned flags) noexcept return success; } -void -SocketEvent::ScheduleImplicit() noexcept -{ - assert(IsDefined()); - assert(scheduled_flags == 0); - - scheduled_flags = IMPLICIT_FLAGS; - loop.AddFD(fd.Get(), scheduled_flags, *this); -} - void SocketEvent::Dispatch() noexcept { const unsigned flags = std::exchange(ready_flags, 0) & - (GetScheduledFlags() | IMPLICIT_FLAGS); + GetScheduledFlags(); if (flags != 0) callback(flags); diff --git a/src/event/SocketEvent.hxx b/src/event/SocketEvent.hxx index 273a9a196..147ebd3d8 100644 --- a/src/event/SocketEvent.hxx +++ b/src/event/SocketEvent.hxx @@ -165,10 +165,10 @@ public: /** * Schedule only the #IMPLICIT_FLAGS without #READ and #WRITE. - * This is not possible with Schedule(), and no other - * ScheduleX()/CancelX() method may be called on this object. */ - void ScheduleImplicit() noexcept; + void ScheduleImplicit() noexcept { + Schedule(IMPLICIT_FLAGS); + } bool IsReadPending() const noexcept { return GetScheduledFlags() & READ;