diff options
Diffstat (limited to 'Swiften/Network/PlatformDomainNameResolver.h')
-rw-r--r-- | Swiften/Network/PlatformDomainNameResolver.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/Swiften/Network/PlatformDomainNameResolver.h b/Swiften/Network/PlatformDomainNameResolver.h index 46c209b..249f2e3 100644 --- a/Swiften/Network/PlatformDomainNameResolver.h +++ b/Swiften/Network/PlatformDomainNameResolver.h @@ -6,7 +6,15 @@ #pragma once -#include "Swiften/Network/DomainNameResolver.h" +#include <deque> +#include <boost/thread.hpp> +#include <boost/thread/mutex.hpp> +#include <boost/thread/condition_variable.hpp> + +#include <Swiften/Network/DomainNameResolver.h> +#include <Swiften/Network/PlatformDomainNameQuery.h> +#include <Swiften/Network/DomainNameServiceQuery.h> +#include <Swiften/Network/DomainNameAddressQuery.h> namespace Swift { class String; @@ -15,11 +23,23 @@ namespace Swift { class PlatformDomainNameResolver : public DomainNameResolver { public: PlatformDomainNameResolver(EventLoop* eventLoop); + ~PlatformDomainNameResolver(); + + virtual DomainNameServiceQuery::ref createServiceQuery(const String& name); + virtual DomainNameAddressQuery::ref createAddressQuery(const String& name); - virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const String& name); - virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const String& name); + private: + void run(); + void addQueryToQueue(PlatformDomainNameQuery::ref); private: + friend class PlatformDomainNameServiceQuery; + friend class PlatformDomainNameAddressQuery; EventLoop* eventLoop; + bool stopRequested; + boost::thread* thread; + std::deque<PlatformDomainNameQuery::ref> queue; + boost::mutex queueMutex; + boost::condition_variable queueNonEmpty; }; } |