diff options
Diffstat (limited to 'src/resolver.h')
-rw-r--r-- | src/resolver.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/resolver.h b/src/resolver.h index 7f1336f..9fe51b2 100644 --- a/src/resolver.h +++ b/src/resolver.h @@ -34,6 +34,7 @@ #include <queue> #include <boost/asio.hpp> +#include <boost/function.hpp> #include "threadUtils.hpp" @@ -41,12 +42,13 @@ template<class Proto> class ResolveHandler { public: - ResolveHandler(const std::string& addr, const std::string& port); + ResolveHandler(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::udp::endpoint)> const& onResolve); void operator()(const boost::system::error_code& e, const boost::asio::ip::basic_resolver_iterator<Proto>); private: std::string addr_; std::string port_; + boost::function<void (boost::asio::ip::udp::endpoint)> callback_; }; typedef ResolveHandler<boost::asio::ip::udp> UdpResolveHandler; @@ -58,10 +60,10 @@ public: static Resolver& instance(); void init(); - static void run(void* s); + /*static */void run(/*void* s*/); - void resolveUdp(const std::string& addr, const std::string& port); - void resolveTcp(const std::string& addr, const std::string& port); + void resolveUdp(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::udp::endpoint)> const& onResolve); + void resolveTcp(const std::string& addr, const std::string& port, boost::function<void (boost::asio::ip::udp::endpoint)> const& onResolve); private: Resolver(); |