event/SocketMonitor: don't filter out ERROR/HANGUP

By bit-wise ANDing the reported flags with GetScheduledFlags(),
ERROR/HANGUP always get cleared.  This means the MPD event loop could
never report those conditions.
This commit is contained in:
Max Kellermann 2020-10-08 21:14:42 +02:00
parent eeb96eb367
commit 41c0bbab13
2 changed files with 7 additions and 1 deletions

View File

@ -30,7 +30,7 @@
void
SocketMonitor::Dispatch(unsigned flags) noexcept
{
flags &= GetScheduledFlags();
flags &= GetScheduledFlags() | IMPLICIT_FLAGS;
if (flags != 0)
OnSocketReady(flags);

View File

@ -57,6 +57,12 @@ public:
static constexpr unsigned ERROR = PollGroup::ERROR;
static constexpr unsigned HANGUP = PollGroup::HANGUP;
/**
* These flags are always reported by epoll_wait() and don't
* need to be registered with epoll_ctl().
*/
static constexpr unsigned IMPLICIT_FLAGS = ERROR|HANGUP;
typedef std::make_signed<size_t>::type ssize_t;
explicit SocketMonitor(EventLoop &_loop) noexcept