diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 34fbba2e6e7..524e6b4c86e 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -729,7 +729,6 @@ namespace aux { #if TORRENT_USE_I2P char const* i2p_session() const override { return m_i2p_conn.session_id(); } - proxy_settings i2p_proxy() const override; void on_i2p_open(error_code const& ec); void open_new_incoming_i2p_connection(); diff --git a/include/libtorrent/aux_/session_interface.hpp b/include/libtorrent/aux_/session_interface.hpp index 84ce2963edb..edda9856531 100644 --- a/include/libtorrent/aux_/session_interface.hpp +++ b/include/libtorrent/aux_/session_interface.hpp @@ -213,7 +213,6 @@ namespace aux { virtual proxy_settings proxy() const = 0; #if TORRENT_USE_I2P - virtual proxy_settings i2p_proxy() const = 0; virtual char const* i2p_session() const = 0; #endif diff --git a/include/libtorrent/settings_pack.hpp b/include/libtorrent/settings_pack.hpp index c899d1cdaaf..1fe66eafd0d 100644 --- a/include/libtorrent/settings_pack.hpp +++ b/include/libtorrent/settings_pack.hpp @@ -363,7 +363,10 @@ namespace aux { proxy_password, // sets the i2p_ SAM bridge to connect to. set the port with the - // ``i2p_port`` setting. + // ``i2p_port`` setting. Unless this is set, i2p torrents are not + // supported. This setting is separate from the other proxy settings + // since i2p torrents and their peers are orthogonal. You can have + // i2p peers as well as regular peers via a proxy. // // .. _i2p: http://www.i2p2.de i2p_hostname, @@ -2206,8 +2209,13 @@ namespace aux { // authorization. The username and password will be sent to the proxy. http_pw, - // route through a i2p SAM proxy +#if TORRENT_USE_I2P + // internal + // This is used internally to communicate with the + // http_tracker_connection. To configure an i2p SAM bridge, set + // i2p_hostname and i2p_port. i2p_proxy +#endif }; private: diff --git a/src/session_impl.cpp b/src/session_impl.cpp index d8ea8018c8f..da2b34d0f1e 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -2354,17 +2354,6 @@ namespace { #endif #if TORRENT_USE_I2P - - proxy_settings session_impl::i2p_proxy() const - { - proxy_settings ret; - - ret.hostname = m_settings.get_str(settings_pack::i2p_hostname); - ret.type = settings_pack::i2p_proxy; - ret.port = std::uint16_t(m_settings.get_int(settings_pack::i2p_port)); - return ret; - } - void session_impl::on_i2p_open(error_code const& ec) { if (ec) diff --git a/src/torrent.cpp b/src/torrent.cpp index 174aa217b43..aecfac0ce1f 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -7350,7 +7350,7 @@ namespace { #if TORRENT_USE_I2P if (peerinfo->is_i2p_addr) { - if (m_ses.i2p_proxy().hostname.empty()) + if (settings().get_str(settings_pack::i2p_hostname).empty()) { // we have an i2p torrent, but we're not connected to an i2p // SAM proxy. @@ -7396,8 +7396,14 @@ namespace { // one. The main feature of a peer connection is that whether or not we // proxy it is configurable. When we use i2p, we want to always prox // everything via i2p. + + aux::proxy_settings proxy; + proxy.hostname = settings().get_str(settings_pack::i2p_hostname); + proxy.port = std::uint16_t(settings().get_int(settings_pack::i2p_port)); + proxy.type = settings_pack::i2p_proxy; + aux::socket_type ret = instantiate_connection(m_ses.get_context() - , m_ses.i2p_proxy(), nullptr, nullptr, false, false); + , proxy, nullptr, nullptr, false, false); boost::get(ret).set_destination(static_cast(peerinfo)->dest()); boost::get(ret).set_command(i2p_stream::cmd_connect); boost::get(ret).set_session_id(m_ses.i2p_session());