code cleanup related to async_resolve (#1873)

This commit is contained in:
Alden Torres 2017-03-30 23:00:59 -04:00 committed by Arvid Norberg
parent 65a2413797
commit 990756ca38
4 changed files with 11 additions and 31 deletions

View File

@ -287,8 +287,6 @@ namespace libtorrent
io_service& get_io_service() override { return m_io_service; }
resolver_interface& get_resolver() override { return m_host_resolver; }
void async_resolve(std::string const& host, int flags
, callback_t const& h) override;
aux::vector<torrent*>& torrent_list(int i) override
{

View File

@ -148,13 +148,6 @@ namespace libtorrent { namespace aux
virtual io_service& get_io_service() = 0;
virtual resolver_interface& get_resolver() = 0;
typedef std::function<void(error_code const&, std::vector<address> const&)>
callback_t;
// TODO: 2 remove this. There's already get_resolver()
virtual void async_resolve(std::string const& host, int flags
, callback_t const& h) = 0;
virtual bool has_connection(peer_connection* p) const = 0;
virtual void insert_peer(std::shared_ptr<peer_connection> const& c) = 0;

View File

@ -45,9 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
#endif
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/asio/ip/v6_only.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/aux_/openssl.hpp"
@ -671,13 +669,7 @@ namespace aux {
#endif
}
void session_impl::async_resolve(std::string const& host, int flags
, session_interface::callback_t const& h)
{
m_host_resolver.async_resolve(host, flags, h);
}
void session_impl::save_state(entry* eptr, std::uint32_t flags) const
void session_impl::save_state(entry* eptr, std::uint32_t const flags) const
{
TORRENT_ASSERT(is_single_thread());

View File

@ -44,15 +44,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cstdio> // for snprintf
#include <functional>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#ifdef TORRENT_USE_OPENSSL
#include "libtorrent/ssl_stream.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/asio/ssl/context.hpp>
#include <boost/asio/ssl/verify_context.hpp>
#endif // TORRENT_USE_OPENSSL
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_USE_OPENSSL
#include "libtorrent/torrent.hpp"
#include "libtorrent/torrent_handle.hpp"
@ -3051,9 +3049,8 @@ namespace libtorrent
#endif
{
ADD_OUTSTANDING_ASYNC("torrent::on_peer_name_lookup");
m_ses.async_resolve(i.hostname, resolver_interface::abort_on_shutdown
, std::bind(&torrent::on_peer_name_lookup
, shared_from_this(), _1, _2, i.port));
m_ses.get_resolver().async_resolve(i.hostname, resolver_interface::abort_on_shutdown
, std::bind(&torrent::on_peer_name_lookup, shared_from_this(), _1, _2, i.port));
}
}
@ -5546,8 +5543,8 @@ namespace libtorrent
// use proxy
web->resolving = true;
m_ses.async_resolve(ps.hostname, resolver_interface::abort_on_shutdown
, [self,web,proxy_port](error_code const& e, std::vector<address> const& addrs)
m_ses.get_resolver().async_resolve(ps.hostname, resolver_interface::abort_on_shutdown
, [self, web, proxy_port](error_code const& e, std::vector<address> const& addrs)
{
self->wrap(&torrent::on_proxy_name_lookup, e, addrs, web, proxy_port);
});
@ -5557,7 +5554,7 @@ namespace libtorrent
|| ps.type == settings_pack::socks5_pw)
&& ps.proxy_peer_connections)
{
connect_web_seed(web, tcp::endpoint(address(), std::uint16_t(port)));
connect_web_seed(web, {address(), std::uint16_t(port)});
}
else
{
@ -5568,8 +5565,8 @@ namespace libtorrent
auto self = shared_from_this();
web->resolving = true;
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
, [self,web,port](error_code const& e, std::vector<address> const& addrs)
m_ses.get_resolver().async_resolve(hostname, resolver_interface::abort_on_shutdown
, [self, web, port](error_code const& e, std::vector<address> const& addrs)
{
self->wrap(&torrent::on_name_lookup, e, addrs, port, web);
});
@ -5653,7 +5650,7 @@ namespace libtorrent
auto self = shared_from_this();
web->resolving = true;
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
m_ses.get_resolver().async_resolve(hostname, resolver_interface::abort_on_shutdown
, [self, web, port](error_code const& err, std::vector<address> const& addr)
{
self->wrap(&torrent::on_name_lookup, err, addr, port, web);