code cleanup related to async_resolve (#1873)
This commit is contained in:
parent
65a2413797
commit
990756ca38
|
@ -287,8 +287,6 @@ namespace libtorrent
|
||||||
|
|
||||||
io_service& get_io_service() override { return m_io_service; }
|
io_service& get_io_service() override { return m_io_service; }
|
||||||
resolver_interface& get_resolver() override { return m_host_resolver; }
|
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
|
aux::vector<torrent*>& torrent_list(int i) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -148,13 +148,6 @@ namespace libtorrent { namespace aux
|
||||||
virtual io_service& get_io_service() = 0;
|
virtual io_service& get_io_service() = 0;
|
||||||
virtual resolver_interface& get_resolver() = 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 bool has_connection(peer_connection* p) const = 0;
|
||||||
virtual void insert_peer(std::shared_ptr<peer_connection> const& c) = 0;
|
virtual void insert_peer(std::shared_ptr<peer_connection> const& c) = 0;
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||||
|
|
||||||
#include <boost/asio/ip/v6_only.hpp>
|
#include <boost/asio/ip/v6_only.hpp>
|
||||||
|
|
||||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||||
|
|
||||||
#include "libtorrent/aux_/openssl.hpp"
|
#include "libtorrent/aux_/openssl.hpp"
|
||||||
|
@ -671,13 +669,7 @@ namespace aux {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::async_resolve(std::string const& host, int flags
|
void session_impl::save_state(entry* eptr, std::uint32_t const flags) const
|
||||||
, 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
|
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
|
|
||||||
|
|
|
@ -44,15 +44,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstdio> // for snprintf
|
#include <cstdio> // for snprintf
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
|
||||||
|
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
#include "libtorrent/ssl_stream.hpp"
|
#include "libtorrent/ssl_stream.hpp"
|
||||||
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||||
#include <boost/asio/ssl/context.hpp>
|
#include <boost/asio/ssl/context.hpp>
|
||||||
#include <boost/asio/ssl/verify_context.hpp>
|
#include <boost/asio/ssl/verify_context.hpp>
|
||||||
#endif // TORRENT_USE_OPENSSL
|
|
||||||
|
|
||||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||||
|
#endif // TORRENT_USE_OPENSSL
|
||||||
|
|
||||||
#include "libtorrent/torrent.hpp"
|
#include "libtorrent/torrent.hpp"
|
||||||
#include "libtorrent/torrent_handle.hpp"
|
#include "libtorrent/torrent_handle.hpp"
|
||||||
|
@ -3051,9 +3049,8 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ADD_OUTSTANDING_ASYNC("torrent::on_peer_name_lookup");
|
ADD_OUTSTANDING_ASYNC("torrent::on_peer_name_lookup");
|
||||||
m_ses.async_resolve(i.hostname, resolver_interface::abort_on_shutdown
|
m_ses.get_resolver().async_resolve(i.hostname, resolver_interface::abort_on_shutdown
|
||||||
, std::bind(&torrent::on_peer_name_lookup
|
, std::bind(&torrent::on_peer_name_lookup, shared_from_this(), _1, _2, i.port));
|
||||||
, shared_from_this(), _1, _2, i.port));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5546,8 +5543,8 @@ namespace libtorrent
|
||||||
|
|
||||||
// use proxy
|
// use proxy
|
||||||
web->resolving = true;
|
web->resolving = true;
|
||||||
m_ses.async_resolve(ps.hostname, resolver_interface::abort_on_shutdown
|
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, web, proxy_port](error_code const& e, std::vector<address> const& addrs)
|
||||||
{
|
{
|
||||||
self->wrap(&torrent::on_proxy_name_lookup, e, addrs, web, proxy_port);
|
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.type == settings_pack::socks5_pw)
|
||||||
&& ps.proxy_peer_connections)
|
&& 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -5568,8 +5565,8 @@ namespace libtorrent
|
||||||
auto self = shared_from_this();
|
auto self = shared_from_this();
|
||||||
web->resolving = true;
|
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& e, std::vector<address> const& addrs)
|
, [self, web, port](error_code const& e, std::vector<address> const& addrs)
|
||||||
{
|
{
|
||||||
self->wrap(&torrent::on_name_lookup, e, addrs, port, web);
|
self->wrap(&torrent::on_name_lookup, e, addrs, port, web);
|
||||||
});
|
});
|
||||||
|
@ -5653,7 +5650,7 @@ namespace libtorrent
|
||||||
|
|
||||||
auto self = shared_from_this();
|
auto self = shared_from_this();
|
||||||
web->resolving = true;
|
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, web, port](error_code const& err, std::vector<address> const& addr)
|
||||||
{
|
{
|
||||||
self->wrap(&torrent::on_name_lookup, err, addr, port, web);
|
self->wrap(&torrent::on_name_lookup, err, addr, port, web);
|
||||||
|
|
Loading…
Reference in New Issue