]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
mplexer: Add a method to inspect the monitored descriptors
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 5 Oct 2020 12:38:00 +0000 (14:38 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 10 Nov 2020 08:52:24 +0000 (09:52 +0100)
pdns/mplexer.hh

index a948c9f075be8f9a548bcff590c2297d41e13136..9408a2ad3748a9ac7555de327c95a5351e7a9319 100644 (file)
@@ -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 {};