From 035ecdc9e285ad2fd9ccf51e4ed2ac01b53dc3d1 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Thu, 15 Jun 2017 10:03:49 +0100 Subject: Replace evdns with getaddrinfo and getnameinfo (#3766) --- src/OSSupport/NetworkLookup.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/OSSupport/NetworkLookup.h (limited to 'src/OSSupport/NetworkLookup.h') diff --git a/src/OSSupport/NetworkLookup.h b/src/OSSupport/NetworkLookup.h new file mode 100644 index 000000000..e09062f4d --- /dev/null +++ b/src/OSSupport/NetworkLookup.h @@ -0,0 +1,42 @@ + +// NetworkLookup.h + +// Declares the cNetworkLookup class representing an executor for asynchronous lookup tasks + +#pragma once + +#include + +#include "IsThread.h" +#include "Queue.h" + + + + + +class cNetworkLookup : + public cIsThread +{ +public: + + cNetworkLookup(); + ~cNetworkLookup(); + + /** Schedule a lookup task for execution. */ + void ScheduleLookup(std::function a_Lookup); + + /** Cancels any scheduled lookups and joins the lookup thread. */ + void Stop(); + +protected: + + /** Process the queue until the thread is stopped. */ + virtual void Execute() override final; + +private: + + /** The queue of lookup tasks waiting to be executed. */ + cQueue> m_WorkQueue; +}; + + -- cgit v1.2.3