X-Git-Url: https://git.syn-net.org/debian/?a=blobdiff_plain;f=src%2Fresolver.cpp;h=55371d037fc34afecde12759da81590522da3e7f;hb=28d7bdf54141384a0940ec092a530fa2779d92a0;hp=06db1b4b2e79c9f33673188eed1944f903fa9e9b;hpb=058ae090a970436caec3b3059e9e18b310dd6b0d;p=anytun.git diff --git a/src/resolver.cpp b/src/resolver.cpp index 06db1b4..55371d0 100644 --- a/src/resolver.cpp +++ b/src/resolver.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -39,20 +40,20 @@ using ::boost::asio::ip::udp; using ::boost::asio::ip::tcp; template -void waitAndEnqueue(u_int32_t s, const std::string& addr, const std::string& port, boost::function)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r) +void waitAndEnqueue(u_int32_t s, const std::string& addr, const std::string& port, boost::function)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r) { cLog.msg(Log::PRIO_ERROR) << "the resolver only supports udp and tcp"; } template<> -void waitAndEnqueue(u_int32_t s, const std::string& addr, const std::string& port, boost::function)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r) +void waitAndEnqueue(u_int32_t s, const std::string& addr, const std::string& port, boost::function)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r) { boost::this_thread::sleep(boost::posix_time::milliseconds(s * 1000)); gResolver.resolveUdp(addr, port, onResolve, onError, r); } template<> -void waitAndEnqueue(u_int32_t s, const std::string& addr, const std::string& port, boost::function)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r) +void waitAndEnqueue(u_int32_t s, const std::string& addr, const std::string& port, boost::function)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r) { boost::this_thread::sleep(boost::posix_time::milliseconds(s * 1000)); gResolver.resolveTcp(addr, port, onResolve, onError, r); @@ -60,16 +61,16 @@ void waitAndEnqueue(u_int32_t s, const std::string& addr, const std::string& por template -ResolveHandler::ResolveHandler(const std::string& addr, const std::string& port, boost::function)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r) : addr_(addr), port_(port), onResolve_(onResolve), onError_(onError), resolv_addr_type_(r) +ResolveHandler::ResolveHandler(const std::string& addr, const std::string& port, boost::function)> const& onResolve, ErrorCallback const& onError, ResolvAddrType r) : addr_(addr), port_(port), onResolve_(onResolve), onError_(onError), resolv_addr_type_(r) { } template -void ResolveHandler::operator()(const boost::system::error_code& e, const boost::asio::ip::basic_resolver_iterator endpointIt) +void ResolveHandler::operator()(const boost::system::error_code& e, boost::asio::ip::basic_resolver_iterator endpointIt) { if(boost::system::posix_error::success == e) { try { - onResolve_(*endpointIt); + onResolve_(endpointIt); } catch(const std::runtime_error& e) {