forked from premiere/premiere-libtorrent
merged changes from RC_1_0
This commit is contained in:
parent
19f3de10dd
commit
4d57456199
|
@ -102,6 +102,7 @@
|
|||
* fix uTP edge case where udp socket buffer fills up
|
||||
* fix nagle implementation in uTP
|
||||
|
||||
* expose i2p_alert to python. cleaning up of i2p connection code
|
||||
* fixed overflow and download performance issue when downloading at high rates
|
||||
* fixed bug in add_torrent_alert::message for magnet links
|
||||
* disable optimistic disconnects when connection limit is low
|
||||
|
|
|
@ -398,6 +398,11 @@ void bind_alert()
|
|||
.add_property("status", &get_status_from_update_alert)
|
||||
;
|
||||
|
||||
class_<i2p_alert, bases<alert>, noncopyable>(
|
||||
"i2p_alert", no_init)
|
||||
.add_property("error", &i2p_alert::error)
|
||||
;
|
||||
|
||||
class_<dht_reply_alert, bases<tracker_alert>, noncopyable>(
|
||||
"dht_reply_alert", no_init)
|
||||
.def_readonly("num_peers", &dht_reply_alert::num_peers)
|
||||
|
|
|
@ -188,7 +188,8 @@ private:
|
|||
, name_lookup_handler handler
|
||||
, boost::shared_ptr<i2p_stream>);
|
||||
|
||||
void set_local_endpoint(error_code const& ec, char const* dest);
|
||||
void set_local_endpoint(error_code const& ec, char const* dest
|
||||
, i2p_stream::handler_type const& h);
|
||||
|
||||
// to talk to i2p SAM bridge
|
||||
boost::shared_ptr<i2p_stream> m_sam_socket;
|
||||
|
|
|
@ -152,18 +152,24 @@ namespace libtorrent
|
|||
#endif
|
||||
m_state = sam_idle;
|
||||
|
||||
do_name_lookup("ME", boost::bind(&i2p_connection::set_local_endpoint, this, _1, _2));
|
||||
if (ec)
|
||||
{
|
||||
h(ec);
|
||||
}
|
||||
|
||||
void i2p_connection::set_local_endpoint(error_code const& ec, char const* dest)
|
||||
{
|
||||
if (ec || dest == 0)
|
||||
{
|
||||
m_i2p_local_endpoint.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
do_name_lookup("ME", boost::bind(&i2p_connection::set_local_endpoint, this, _1, _2, h));
|
||||
}
|
||||
|
||||
void i2p_connection::set_local_endpoint(error_code const& ec, char const* dest
|
||||
, i2p_stream::handler_type const& h)
|
||||
{
|
||||
if (!ec && dest != 0)
|
||||
m_i2p_local_endpoint = dest;
|
||||
else
|
||||
m_i2p_local_endpoint.clear();
|
||||
|
||||
h(ec);
|
||||
}
|
||||
|
||||
void i2p_connection::async_name_lookup(char const* name
|
||||
|
|
|
@ -2688,11 +2688,15 @@ retry:
|
|||
// pause the session now and resume it once we've
|
||||
// established the i2p SAM connection
|
||||
#if TORRENT_USE_I2P
|
||||
if (m_settings.get_str(settings_pack::i2p_hostname).empty())
|
||||
{
|
||||
error_code ec;
|
||||
m_i2p_conn.close(ec);
|
||||
return;
|
||||
}
|
||||
m_i2p_conn.open(m_settings.get_str(settings_pack::i2p_hostname)
|
||||
, m_settings.get_int(settings_pack::i2p_port)
|
||||
, boost::bind(&session_impl::on_i2p_open, this, _1));
|
||||
|
||||
open_new_incoming_i2p_connection();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -7137,6 +7137,16 @@ namespace libtorrent
|
|||
bool i2p = peerinfo->is_i2p_addr;
|
||||
if (i2p)
|
||||
{
|
||||
if (m_ses.i2p_proxy().hostname.empty())
|
||||
{
|
||||
// we have an i2p torrent, but we're not connected to an i2p
|
||||
// SAM proxy.
|
||||
if (alerts().should_post<i2p_alert>())
|
||||
alerts().post_alert(i2p_alert(error_code(errors::no_i2p_router
|
||||
, get_libtorrent_category())));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = instantiate_connection(m_ses.get_io_service(), m_ses.i2p_proxy(), *s);
|
||||
(void)ret;
|
||||
TORRENT_ASSERT(ret);
|
||||
|
|
|
@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/alert_dispatcher.hpp"
|
||||
#include "libtorrent/performance_counters.hpp" // for counters
|
||||
#include "libtorrent/random.hpp"
|
||||
#include "libtorrent/ed25519.hpp"
|
||||
|
||||
#include "libtorrent/kademlia/node_id.hpp"
|
||||
#include "libtorrent/kademlia/routing_table.hpp"
|
||||
|
|
Loading…
Reference in New Issue