Browse Source

Fix building libtorrent with boost >= 1.70

Closes #435.
Closes #437.
miguelfreitas
Chocobo1 4 years ago
parent
commit
55ece85ce9
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 2
      libtorrent/include/libtorrent/io_service.hpp
  2. 9
      libtorrent/include/libtorrent/io_service_fwd.hpp
  3. 2
      libtorrent/include/libtorrent/proxy_base.hpp
  4. 6
      libtorrent/include/libtorrent/socket_type.hpp
  5. 2
      libtorrent/include/libtorrent/ssl_stream.hpp
  6. 3
      libtorrent/include/libtorrent/udp_socket.hpp
  7. 4
      libtorrent/src/connection_queue.cpp
  8. 14
      libtorrent/src/http_connection.cpp
  9. 8
      libtorrent/src/kademlia/dht_tracker.cpp
  10. 2
      libtorrent/src/natpmp.cpp
  11. 10
      libtorrent/src/utp_socket_manager.cpp

2
libtorrent/include/libtorrent/io_service.hpp

@ -62,6 +62,8 @@ POSSIBILITY OF SUCH DAMAGE.
#undef Protocol #undef Protocol
#endif #endif
#include "libtorrent/io_service_fwd.hpp"
namespace libtorrent namespace libtorrent
{ {

9
libtorrent/include/libtorrent/io_service_fwd.hpp

@ -75,6 +75,15 @@ namespace libtorrent
#else #else
typedef boost::asio::io_service io_service; typedef boost::asio::io_service io_service;
#endif #endif
#if BOOST_VERSION >= 107000
template <typename T>
io_service& get_io_service(T& o) { return static_cast<io_service&>(o.get_executor().context()); }
#else
template <typename T>
io_service& get_io_service(T& o) { return o.get_io_service(); }
#endif
} }
#endif #endif

2
libtorrent/include/libtorrent/proxy_base.hpp

@ -229,7 +229,7 @@ public:
io_service& get_io_service() io_service& get_io_service()
{ {
return m_sock.get_io_service(); return libtorrent::get_io_service(m_sock);
} }
lowest_layer_type& lowest_layer() lowest_layer_type& lowest_layer()

6
libtorrent/include/libtorrent/socket_type.hpp

@ -182,7 +182,11 @@ namespace libtorrent
{ {
typedef stream_socket::endpoint_type endpoint_type; typedef stream_socket::endpoint_type endpoint_type;
typedef stream_socket::protocol_type protocol_type; typedef stream_socket::protocol_type protocol_type;
#if BOOST_VERSION >= 106600
typedef tcp::socket::executor_type executor_type;
#endif
explicit socket_type(io_service& ios): m_io_service(ios), m_type(0) {} explicit socket_type(io_service& ios): m_io_service(ios), m_type(0) {}
~socket_type(); ~socket_type();

2
libtorrent/include/libtorrent/ssl_stream.hpp

@ -258,7 +258,7 @@ public:
io_service& get_io_service() io_service& get_io_service()
{ {
return m_sock.get_io_service(); return get_io_service(m_sock);
} }
lowest_layer_type& lowest_layer() lowest_layer_type& lowest_layer()

3
libtorrent/include/libtorrent/udp_socket.hpp

@ -80,7 +80,8 @@ namespace libtorrent
#endif #endif
; ;
} }
io_service& get_io_service() { return m_ipv4_sock.get_io_service(); } io_service& get_io_service() { return libtorrent::get_io_service(m_ipv4_sock); }
udp::socket::executor_type get_executor() { return m_ipv4_sock.get_executor(); }
void subscribe(udp_socket_observer* o); void subscribe(udp_socket_observer* o);
void unsubscribe(udp_socket_observer* o); void unsubscribe(udp_socket_observer* o);

4
libtorrent/src/connection_queue.cpp

@ -100,7 +100,7 @@ namespace libtorrent
if (m_num_connecting < m_half_open_limit if (m_num_connecting < m_half_open_limit
|| m_half_open_limit == 0) || m_half_open_limit == 0)
m_timer.get_io_service().post(boost::bind( get_io_service(m_timer).post(boost::bind(
&connection_queue::on_try_connect, this)); &connection_queue::on_try_connect, this));
} }
@ -122,7 +122,7 @@ namespace libtorrent
if (m_num_connecting < m_half_open_limit if (m_num_connecting < m_half_open_limit
|| m_half_open_limit == 0) || m_half_open_limit == 0)
m_timer.get_io_service().post(boost::bind( get_io_service(m_timer).post(boost::bind(
&connection_queue::on_try_connect, this)); &connection_queue::on_try_connect, this));
} }

14
libtorrent/src/http_connection.cpp

@ -134,14 +134,14 @@ void http_connection::get(std::string const& url, time_duration timeout, int pri
) )
{ {
error_code ec(errors::unsupported_url_protocol); error_code ec(errors::unsupported_url_protocol);
m_resolver.get_io_service().post(boost::bind(&http_connection::callback get_io_service(m_resolver).post(boost::bind(&http_connection::callback
, me, ec, (char*)0, 0)); , me, ec, (char*)0, 0));
return; return;
} }
if (ec) if (ec)
{ {
m_resolver.get_io_service().post(boost::bind(&http_connection::callback get_io_service(m_resolver).post(boost::bind(&http_connection::callback
, me, ec, (char*)0, 0)); , me, ec, (char*)0, 0));
return; return;
} }
@ -239,7 +239,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
if (ec) if (ec)
{ {
m_resolver.get_io_service().post(boost::bind(&http_connection::callback get_io_service(m_resolver).post(boost::bind(&http_connection::callback
, me, ec, (char*)0, 0)); , me, ec, (char*)0, 0));
return; return;
} }
@ -279,7 +279,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
#if TORRENT_USE_I2P #if TORRENT_USE_I2P
if (is_i2p && i2p_conn->proxy().type != proxy_settings::i2p_proxy) if (is_i2p && i2p_conn->proxy().type != proxy_settings::i2p_proxy)
{ {
m_resolver.get_io_service().post(boost::bind(&http_connection::callback get_io_service(m_resolver).post(boost::bind(&http_connection::callback
, me, error_code(errors::no_i2p_router, get_libtorrent_category()), (char*)0, 0)); , me, error_code(errors::no_i2p_router, get_libtorrent_category()), (char*)0, 0));
return; return;
} }
@ -319,7 +319,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
userdata = m_ssl_ctx; userdata = m_ssl_ctx;
} }
#endif #endif
instantiate_connection(m_resolver.get_io_service() instantiate_connection(get_io_service(m_resolver)
, proxy ? *proxy : null_proxy, m_sock, userdata); , proxy ? *proxy : null_proxy, m_sock, userdata);
if (m_bind_addr != address_v4::any()) if (m_bind_addr != address_v4::any())
@ -329,7 +329,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
m_sock.bind(tcp::endpoint(m_bind_addr, 0), ec); m_sock.bind(tcp::endpoint(m_bind_addr, 0), ec);
if (ec) if (ec)
{ {
m_resolver.get_io_service().post(boost::bind(&http_connection::callback get_io_service(m_resolver).post(boost::bind(&http_connection::callback
, me, ec, (char*)0, 0)); , me, ec, (char*)0, 0));
return; return;
} }
@ -338,7 +338,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
setup_ssl_hostname(m_sock, hostname, ec); setup_ssl_hostname(m_sock, hostname, ec);
if (ec) if (ec)
{ {
m_resolver.get_io_service().post(boost::bind(&http_connection::callback get_io_service(m_resolver).post(boost::bind(&http_connection::callback
, me, ec, (char*)0, 0)); , me, ec, (char*)0, 0));
return; return;
} }

8
libtorrent/src/kademlia/dht_tracker.cpp

@ -208,13 +208,13 @@ namespace libtorrent { namespace dht
, ses.external_address().external_address(address_v4()), &ses) , ses.external_address().external_address(address_v4()), &ses)
, m_sock(sock) , m_sock(sock)
, m_last_new_key(time_now() - minutes(key_refresh)) , m_last_new_key(time_now() - minutes(key_refresh))
, m_timer(sock.get_io_service()) , m_timer(get_io_service(sock))
, m_connection_timer(sock.get_io_service()) , m_connection_timer(get_io_service(sock))
, m_refresh_timer(sock.get_io_service()) , m_refresh_timer(get_io_service(sock))
, m_settings(settings) , m_settings(settings)
, m_refresh_bucket(160) , m_refresh_bucket(160)
, m_abort(false) , m_abort(false)
, m_host_resolver(sock.get_io_service()) , m_host_resolver(get_io_service(sock))
, m_sent_bytes(0) , m_sent_bytes(0)
, m_received_bytes(0) , m_received_bytes(0)
, m_refs(0) , m_refs(0)

2
libtorrent/src/natpmp.cpp

@ -90,7 +90,7 @@ void natpmp::rebind(address const& listen_interface)
mutex::scoped_lock l(m_mutex); mutex::scoped_lock l(m_mutex);
error_code ec; error_code ec;
address gateway = get_default_gateway(m_socket.get_io_service(), ec); address gateway = get_default_gateway(get_io_service(m_socket), ec);
if (ec) if (ec)
{ {
char msg[200]; char msg[200];

10
libtorrent/src/utp_socket_manager.cpp

@ -111,7 +111,7 @@ namespace libtorrent
{ {
m_last_route_update = time_now(); m_last_route_update = time_now();
error_code ec; error_code ec;
m_routes = enum_routes(m_sock.get_io_service(), ec); m_routes = enum_routes(get_io_service(m_sock), ec);
} }
int mtu = 0; int mtu = 0;
@ -220,7 +220,7 @@ namespace libtorrent
{ {
m_last_route_update = time_now(); m_last_route_update = time_now();
error_code ec; error_code ec;
m_routes = enum_routes(m_sock.get_io_service(), ec); m_routes = enum_routes(get_io_service(m_sock), ec);
if (ec) return socket_ep; if (ec) return socket_ep;
} }
@ -251,7 +251,7 @@ namespace libtorrent
{ {
m_last_if_update = time_now(); m_last_if_update = time_now();
error_code ec; error_code ec;
m_interfaces = enum_net_interfaces(m_sock.get_io_service(), ec); m_interfaces = enum_net_interfaces(get_io_service(m_sock), ec);
if (ec) return socket_ep; if (ec) return socket_ep;
} }
@ -320,14 +320,14 @@ namespace libtorrent
// UTP_LOGV("not found, new connection id:%d\n", m_new_connection); // UTP_LOGV("not found, new connection id:%d\n", m_new_connection);
boost::shared_ptr<socket_type> c(new (std::nothrow) socket_type(m_sock.get_io_service())); boost::shared_ptr<socket_type> c(new (std::nothrow) socket_type(get_io_service(m_sock)));
if (!c) return false; if (!c) return false;
TORRENT_ASSERT(m_new_connection == -1); TORRENT_ASSERT(m_new_connection == -1);
// create the new socket with this ID // create the new socket with this ID
m_new_connection = id; m_new_connection = id;
instantiate_connection(m_sock.get_io_service(), proxy_settings(), *c, 0, this); instantiate_connection(get_io_service(m_sock), proxy_settings(), *c, 0, this);
utp_stream* str = c->get<utp_stream>(); utp_stream* str = c->get<utp_stream>();
TORRENT_ASSERT(str); TORRENT_ASSERT(str);
int link_mtu, utp_mtu; int link_mtu, utp_mtu;

Loading…
Cancel
Save