From f75b8a3b95f4b06ffe0f7b16b6552e1b10560b6e Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 5 Oct 2020 14:38:00 +0200 Subject: [PATCH] mplexer: Add a method to inspect the monitored descriptors --- pdns/mplexer.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pdns/mplexer.hh b/pdns/mplexer.hh index a948c9f075..9408a2ad37 100644 --- a/pdns/mplexer.hh +++ b/pdns/mplexer.hh @@ -178,6 +178,16 @@ public: return writeFDs ? d_writeCallbacks.size() : d_readCallbacks.size(); } + void runForAllWatchedFDs(void(*watcher)(bool isRead, int fd, const funcparam_t&, struct timeval)) + { + for (const auto& entry : d_readCallbacks) { + watcher(true, entry.d_fd, entry.d_parameter, entry.d_ttd); + } + for (const auto& entry : d_writeCallbacks) { + watcher(false, entry.d_fd, entry.d_parameter, entry.d_ttd); + } + } + protected: struct FDBasedTag {}; struct TTDOrderedTag {}; -- 2.47.3