mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-23 16:48:21 +00:00
lt sync 2868
This commit is contained in:
parent
a6802b455a
commit
ef7e000b70
@ -158,7 +158,7 @@ namespace libtorrent
|
|||||||
enum performance_warning_t
|
enum performance_warning_t
|
||||||
{
|
{
|
||||||
outstanding_disk_buffer_limit_reached,
|
outstanding_disk_buffer_limit_reached,
|
||||||
outstanding_request_limit_reached,
|
outstanding_request_limit_reached
|
||||||
};
|
};
|
||||||
|
|
||||||
performance_alert(torrent_handle const& h
|
performance_alert(torrent_handle const& h
|
||||||
|
@ -153,7 +153,8 @@ struct bandwidth_manager
|
|||||||
m_queue.clear();
|
m_queue.clear();
|
||||||
m_history.clear();
|
m_history.clear();
|
||||||
m_current_quota = 0;
|
m_current_quota = 0;
|
||||||
m_history_timer.cancel();
|
error_code ec;
|
||||||
|
m_history_timer.cancel(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -226,7 +226,7 @@ namespace libtorrent
|
|||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, lazy_entry const& e);
|
std::ostream& operator<<(std::ostream& os, lazy_entry const& e);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -205,7 +205,7 @@ namespace libtorrent
|
|||||||
{
|
{
|
||||||
enum flags_t
|
enum flags_t
|
||||||
{
|
{
|
||||||
banned = 1,
|
banned = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
tcp::endpoint ip;
|
tcp::endpoint ip;
|
||||||
|
@ -380,7 +380,7 @@ namespace libtorrent
|
|||||||
// the priority value that means the piece is filtered
|
// the priority value that means the piece is filtered
|
||||||
filter_priority = 0,
|
filter_priority = 0,
|
||||||
// the max number the peer count can hold
|
// the max number the peer count can hold
|
||||||
max_peer_count = 0x3ff,
|
max_peer_count = 0x3ff
|
||||||
};
|
};
|
||||||
|
|
||||||
bool have() const { return index == we_have_index; }
|
bool have() const { return index == we_have_index; }
|
||||||
|
@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef TORRENT_SESSION_STATUS_HPP_INCLUDED
|
#ifndef TORRENT_SESSION_STATUS_HPP_INCLUDED
|
||||||
#define TORRENT_SESSION_STATUS_HPP_INCLUDED
|
#define TORRENT_SESSION_STATUS_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include "libtorrent/config.hpp"
|
||||||
|
#include "libtorrent/size_type.hpp"
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,8 @@ public:
|
|||||||
: m_context(io_service, asio::ssl::context::sslv23_client)
|
: m_context(io_service, asio::ssl::context::sslv23_client)
|
||||||
, m_sock(io_service, m_context)
|
, m_sock(io_service, m_context)
|
||||||
{
|
{
|
||||||
m_context.set_verify_mode(asio::ssl::context::verify_none);
|
error_code ec;
|
||||||
|
m_context.set_verify_mode(asio::ssl::context::verify_none, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef Stream next_layer_type;
|
typedef Stream next_layer_type;
|
||||||
|
@ -219,9 +219,6 @@ namespace libtorrent
|
|||||||
if (ec) return;
|
if (ec) return;
|
||||||
s->bind(udp::endpoint(addr, 0), ec);
|
s->bind(udp::endpoint(addr, 0), ec);
|
||||||
if (ec) return;
|
if (ec) return;
|
||||||
if (addr.is_v4())
|
|
||||||
s->set_option(outbound_interface(addr.to_v4()), ec);
|
|
||||||
if (ec) return;
|
|
||||||
m_unicast_sockets.push_back(socket_entry(s));
|
m_unicast_sockets.push_back(socket_entry(s));
|
||||||
socket_entry& se = m_unicast_sockets.back();
|
socket_entry& se = m_unicast_sockets.back();
|
||||||
s->async_receive_from(asio::buffer(se.buffer, sizeof(se.buffer))
|
s->async_receive_from(asio::buffer(se.buffer, sizeof(se.buffer))
|
||||||
|
@ -1279,6 +1279,7 @@ namespace libtorrent
|
|||||||
else
|
else
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
if (is_disconnecting()) return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// there is supposed to be a remote listen port
|
// there is supposed to be a remote listen port
|
||||||
|
@ -205,7 +205,8 @@ void http_connection::on_connect_timeout()
|
|||||||
|
|
||||||
if (!m_endpoints.empty())
|
if (!m_endpoints.empty())
|
||||||
{
|
{
|
||||||
m_sock.close();
|
error_code ec;
|
||||||
|
m_sock.close(ec);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -226,8 +227,8 @@ void http_connection::on_timeout(boost::weak_ptr<http_connection> p
|
|||||||
{
|
{
|
||||||
if (c->m_connection_ticket > -1 && !c->m_endpoints.empty())
|
if (c->m_connection_ticket > -1 && !c->m_endpoints.empty())
|
||||||
{
|
{
|
||||||
c->m_sock.close();
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
|
c->m_sock.close(ec);
|
||||||
c->m_timer.expires_at(c->m_last_receive + c->m_timeout, ec);
|
c->m_timer.expires_at(c->m_last_receive + c->m_timeout, ec);
|
||||||
c->m_timer.async_wait(bind(&http_connection::on_timeout, p, _1));
|
c->m_timer.async_wait(bind(&http_connection::on_timeout, p, _1));
|
||||||
}
|
}
|
||||||
@ -321,7 +322,8 @@ void http_connection::on_connect(error_code const& e)
|
|||||||
else if (!m_endpoints.empty() && !m_abort)
|
else if (!m_endpoints.empty() && !m_abort)
|
||||||
{
|
{
|
||||||
// The connection failed. Try the next endpoint in the list.
|
// The connection failed. Try the next endpoint in the list.
|
||||||
m_sock.close();
|
error_code ec;
|
||||||
|
m_sock.close(ec);
|
||||||
queue_connect();
|
queue_connect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -353,7 +355,8 @@ void http_connection::callback(error_code const& e, char const* data, int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_called = true;
|
m_called = true;
|
||||||
m_timer.cancel();
|
error_code ec;
|
||||||
|
m_timer.cancel(ec);
|
||||||
if (m_handler) m_handler(e, m_parser, data, size, *this);
|
if (m_handler) m_handler(e, m_parser, data, size, *this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,8 +157,9 @@ namespace libtorrent
|
|||||||
|
|
||||||
if (m_settings.announce_ip != address())
|
if (m_settings.announce_ip != address())
|
||||||
{
|
{
|
||||||
url += "&ip=";
|
error_code ec;
|
||||||
url += m_settings.announce_ip.to_string();
|
std::string ip = m_settings.announce_ip.to_string(ec);
|
||||||
|
if (!ec) url += "&ip=" + ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||||
@ -377,7 +378,9 @@ namespace libtorrent
|
|||||||
|
|
||||||
peer_entry p;
|
peer_entry p;
|
||||||
p.pid.clear();
|
p.pid.clear();
|
||||||
p.ip = detail::read_v4_address(i).to_string();
|
error_code ec;
|
||||||
|
p.ip = detail::read_v4_address(i).to_string(ec);
|
||||||
|
if (ec) continue;
|
||||||
p.port = detail::read_uint16(i);
|
p.port = detail::read_uint16(i);
|
||||||
peer_list.push_back(p);
|
peer_list.push_back(p);
|
||||||
}
|
}
|
||||||
@ -409,7 +412,9 @@ namespace libtorrent
|
|||||||
|
|
||||||
peer_entry p;
|
peer_entry p;
|
||||||
p.pid.clear();
|
p.pid.clear();
|
||||||
p.ip = detail::read_v6_address(i).to_string();
|
error_code ec;
|
||||||
|
p.ip = detail::read_v6_address(i).to_string(ec);
|
||||||
|
if (ec) continue;
|
||||||
p.port = detail::read_uint16(i);
|
p.port = detail::read_uint16(i);
|
||||||
peer_list.push_back(p);
|
peer_list.push_back(p);
|
||||||
}
|
}
|
||||||
|
@ -87,10 +87,12 @@ namespace
|
|||||||
void read_endpoint_list(libtorrent::entry const* n, std::vector<EndpointType>& epl)
|
void read_endpoint_list(libtorrent::entry const* n, std::vector<EndpointType>& epl)
|
||||||
{
|
{
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
if (n->type() != entry::list_t) return;
|
||||||
entry::list_type const& contacts = n->list();
|
entry::list_type const& contacts = n->list();
|
||||||
for (entry::list_type::const_iterator i = contacts.begin()
|
for (entry::list_type::const_iterator i = contacts.begin()
|
||||||
, end(contacts.end()); i != end; ++i)
|
, end(contacts.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
|
if (i->type() != entry::string_t) return;
|
||||||
std::string const& p = i->string();
|
std::string const& p = i->string();
|
||||||
if (p.size() < 6) continue;
|
if (p.size() < 6) continue;
|
||||||
std::string::const_iterator in = p.begin();
|
std::string::const_iterator in = p.begin();
|
||||||
@ -189,14 +191,15 @@ namespace libtorrent { namespace dht
|
|||||||
m_dht.set_node_id(boost::lexical_cast<node_id>(nid->string()));
|
m_dht.set_node_id(boost::lexical_cast<node_id>(nid->string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_timer.expires_from_now(seconds(1));
|
error_code ec;
|
||||||
|
m_timer.expires_from_now(seconds(1), ec);
|
||||||
m_timer.async_wait(bind(&dht_tracker::tick, self(), _1));
|
m_timer.async_wait(bind(&dht_tracker::tick, self(), _1));
|
||||||
|
|
||||||
m_connection_timer.expires_from_now(seconds(10));
|
m_connection_timer.expires_from_now(seconds(10), ec);
|
||||||
m_connection_timer.async_wait(
|
m_connection_timer.async_wait(
|
||||||
bind(&dht_tracker::connection_timeout, self(), _1));
|
bind(&dht_tracker::connection_timeout, self(), _1));
|
||||||
|
|
||||||
m_refresh_timer.expires_from_now(seconds(5));
|
m_refresh_timer.expires_from_now(seconds(5), ec);
|
||||||
m_refresh_timer.async_wait(bind(&dht_tracker::refresh_timeout, self(), _1));
|
m_refresh_timer.async_wait(bind(&dht_tracker::refresh_timeout, self(), _1));
|
||||||
|
|
||||||
m_dht.bootstrap(initial_nodes, bind(&dht_tracker::on_bootstrap, self()));
|
m_dht.bootstrap(initial_nodes, bind(&dht_tracker::on_bootstrap, self()));
|
||||||
@ -206,9 +209,10 @@ namespace libtorrent { namespace dht
|
|||||||
{
|
{
|
||||||
mutex_t::scoped_lock l(m_mutex);
|
mutex_t::scoped_lock l(m_mutex);
|
||||||
m_abort = true;
|
m_abort = true;
|
||||||
m_timer.cancel();
|
error_code ec;
|
||||||
m_connection_timer.cancel();
|
m_timer.cancel(ec);
|
||||||
m_refresh_timer.cancel();
|
m_connection_timer.cancel(ec);
|
||||||
|
m_refresh_timer.cancel(ec);
|
||||||
m_host_resolver.cancel();
|
m_host_resolver.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,7 +784,6 @@ namespace libtorrent { namespace dht
|
|||||||
void write_nodes_entry(entry& r, libtorrent::dht::msg const& m)
|
void write_nodes_entry(entry& r, libtorrent::dht::msg const& m)
|
||||||
{
|
{
|
||||||
bool ipv6_nodes = false;
|
bool ipv6_nodes = false;
|
||||||
r["nodes"] = entry(entry::string_t);
|
|
||||||
entry& n = r["nodes"];
|
entry& n = r["nodes"];
|
||||||
std::back_insert_iterator<std::string> out(n.string());
|
std::back_insert_iterator<std::string> out(n.string());
|
||||||
for (msg::nodes_t::const_iterator i = m.nodes.begin()
|
for (msg::nodes_t::const_iterator i = m.nodes.begin()
|
||||||
@ -797,7 +800,6 @@ namespace libtorrent { namespace dht
|
|||||||
|
|
||||||
if (ipv6_nodes)
|
if (ipv6_nodes)
|
||||||
{
|
{
|
||||||
r["nodes2"] = entry(entry::list_t);
|
|
||||||
entry& p = r["nodes2"];
|
entry& p = r["nodes2"];
|
||||||
std::string endpoint;
|
std::string endpoint;
|
||||||
for (msg::nodes_t::const_iterator i = m.nodes.begin()
|
for (msg::nodes_t::const_iterator i = m.nodes.begin()
|
||||||
|
@ -122,7 +122,9 @@ bool node_impl::verify_token(msg const& m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasher h1;
|
hasher h1;
|
||||||
std::string address = m.addr.address().to_string();
|
error_code ec;
|
||||||
|
std::string address = m.addr.address().to_string(ec);
|
||||||
|
if (ec) return false;
|
||||||
h1.update(&address[0], address.length());
|
h1.update(&address[0], address.length());
|
||||||
h1.update((char*)&m_secret[0], sizeof(m_secret[0]));
|
h1.update((char*)&m_secret[0], sizeof(m_secret[0]));
|
||||||
h1.update((char*)&m.info_hash[0], sha1_hash::size);
|
h1.update((char*)&m.info_hash[0], sha1_hash::size);
|
||||||
@ -146,7 +148,9 @@ entry node_impl::generate_token(msg const& m)
|
|||||||
std::string token;
|
std::string token;
|
||||||
token.resize(4);
|
token.resize(4);
|
||||||
hasher h;
|
hasher h;
|
||||||
std::string address = m.addr.address().to_string();
|
error_code ec;
|
||||||
|
std::string address = m.addr.address().to_string(ec);
|
||||||
|
TORRENT_ASSERT(!ec);
|
||||||
h.update(&address[0], address.length());
|
h.update(&address[0], address.length());
|
||||||
h.update((char*)&m_secret[0], sizeof(m_secret[0]));
|
h.update((char*)&m_secret[0], sizeof(m_secret[0]));
|
||||||
h.update((char*)&m.info_hash[0], sha1_hash::size);
|
h.update((char*)&m.info_hash[0], sha1_hash::size);
|
||||||
|
@ -211,8 +211,9 @@ namespace
|
|||||||
virtual boost::shared_ptr<peer_plugin> new_connection(
|
virtual boost::shared_ptr<peer_plugin> new_connection(
|
||||||
peer_connection* pc)
|
peer_connection* pc)
|
||||||
{
|
{
|
||||||
|
error_code ec;
|
||||||
return boost::shared_ptr<peer_plugin>(new logger_peer_plugin(
|
return boost::shared_ptr<peer_plugin>(new logger_peer_plugin(
|
||||||
pc->remote().address().to_string() + "_"
|
pc->remote().address().to_string(ec) + "_"
|
||||||
+ boost::lexical_cast<std::string>(pc->remote().port()) + ".log"));
|
+ boost::lexical_cast<std::string>(pc->remote().port()) + ".log"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -155,7 +155,8 @@ namespace libtorrent
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||||
m_logger = m_ses.create_log(m_remote.address().to_string() + "_"
|
error_code ec;
|
||||||
|
m_logger = m_ses.create_log(m_remote.address().to_string(ec) + "_"
|
||||||
+ boost::lexical_cast<std::string>(m_remote.port()), m_ses.listen_port());
|
+ boost::lexical_cast<std::string>(m_remote.port()), m_ses.listen_port());
|
||||||
(*m_logger) << "*** OUTGOING CONNECTION\n";
|
(*m_logger) << "*** OUTGOING CONNECTION\n";
|
||||||
#endif
|
#endif
|
||||||
@ -2440,7 +2441,8 @@ namespace libtorrent
|
|||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_connecting);
|
TORRENT_ASSERT(m_connecting);
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||||
(*m_ses.m_logger) << time_now_string() << " CONNECTION TIMED OUT: " << m_remote.address().to_string()
|
error_code ec;
|
||||||
|
(*m_ses.m_logger) << time_now_string() << " CONNECTION TIMED OUT: " << m_remote.address().to_string(ec)
|
||||||
<< "\n";
|
<< "\n";
|
||||||
#endif
|
#endif
|
||||||
disconnect("timed out: connect", 1);
|
disconnect("timed out: connect", 1);
|
||||||
@ -3714,10 +3716,11 @@ namespace libtorrent
|
|||||||
m_connecting = false;
|
m_connecting = false;
|
||||||
m_ses.m_half_open.done(m_connection_ticket);
|
m_ses.m_half_open.done(m_connection_ticket);
|
||||||
|
|
||||||
|
error_code ec;
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||||
(*m_ses.m_logger) << time_now_string() << " CONNECTION FAILED: " << m_remote.address().to_string()
|
(*m_ses.m_logger) << time_now_string() << " CONNECTION FAILED: " << m_remote.address().to_string(ec)
|
||||||
<< ": " << e.message() << "\n";
|
<< ": " << e.message() << "\n";
|
||||||
#endif
|
#endif
|
||||||
disconnect(e.message().c_str(), 1);
|
disconnect(e.message().c_str(), 1);
|
||||||
@ -3731,11 +3734,10 @@ namespace libtorrent
|
|||||||
|
|
||||||
TORRENT_ASSERT(m_socket);
|
TORRENT_ASSERT(m_socket);
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
|
||||||
(*m_ses.m_logger) << time_now_string() << " COMPLETED: " << m_remote.address().to_string()
|
(*m_ses.m_logger) << time_now_string() << " COMPLETED: " << m_remote.address().to_string(ec)
|
||||||
<< " rtt = " << m_rtt << "\n";
|
<< " rtt = " << m_rtt << "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
error_code ec;
|
|
||||||
if (m_remote == m_socket->local_endpoint(ec))
|
if (m_remote == m_socket->local_endpoint(ec))
|
||||||
{
|
{
|
||||||
// if the remote endpoint is the same as the local endpoint, we're connected
|
// if the remote endpoint is the same as the local endpoint, we're connected
|
||||||
|
@ -825,7 +825,8 @@ namespace libtorrent
|
|||||||
// to this peer. don't connect to
|
// to this peer. don't connect to
|
||||||
// it again.
|
// it again.
|
||||||
|
|
||||||
m_torrent->debug_log("already connected to peer: " + remote.address().to_string() + ":"
|
error_code ec;
|
||||||
|
m_torrent->debug_log("already connected to peer: " + remote.address().to_string(ec) + ":"
|
||||||
+ boost::lexical_cast<std::string>(remote.port()) + " "
|
+ boost::lexical_cast<std::string>(remote.port()) + " "
|
||||||
+ boost::lexical_cast<std::string>(i->second.connection->pid()));
|
+ boost::lexical_cast<std::string>(i->second.connection->pid()));
|
||||||
|
|
||||||
|
@ -150,7 +150,11 @@ namespace libtorrent
|
|||||||
if (flags & start_default_features)
|
if (flags & start_default_features)
|
||||||
{
|
{
|
||||||
start_upnp();
|
start_upnp();
|
||||||
start_upnp();
|
start_natpmp();
|
||||||
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
|
start_dht();
|
||||||
|
#endif
|
||||||
|
start_lsd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,6 +189,10 @@ namespace libtorrent
|
|||||||
{
|
{
|
||||||
start_upnp();
|
start_upnp();
|
||||||
start_natpmp();
|
start_natpmp();
|
||||||
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
|
start_dht();
|
||||||
|
#endif
|
||||||
|
start_lsd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1845,8 +1845,11 @@ namespace aux {
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
sha1_hash i_hash = t.torrent_file().info_hash();
|
sha1_hash i_hash = t.torrent_file().info_hash();
|
||||||
#endif
|
#endif
|
||||||
i->second->set_queue_position(-1);
|
t.set_queue_position(-1);
|
||||||
m_torrents.erase(i);
|
m_torrents.erase(i);
|
||||||
|
std::list<boost::shared_ptr<torrent> >::iterator k
|
||||||
|
= std::find(m_queued_for_checking.begin(), m_queued_for_checking.end(), tptr);
|
||||||
|
if (k != m_queued_for_checking.end()) m_queued_for_checking.erase(k);
|
||||||
TORRENT_ASSERT(m_torrents.find(i_hash) == m_torrents.end());
|
TORRENT_ASSERT(m_torrents.find(i_hash) == m_torrents.end());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2052,15 +2055,10 @@ namespace aux {
|
|||||||
|| m_dht_same_port)
|
|| m_dht_same_port)
|
||||||
{
|
{
|
||||||
m_dht_same_port = true;
|
m_dht_same_port = true;
|
||||||
// if you hit this assert you are trying to start the
|
if (m_listen_interface.port() > 0)
|
||||||
// DHT with the same port as the tcp listen port
|
|
||||||
// (which is default) _before_ you have opened the
|
|
||||||
// tcp listen port (so there is no configured port to use)
|
|
||||||
// basically, make sure you call listen_on() before
|
|
||||||
// start_dht(). See documentation for listen_on() for
|
|
||||||
// more information.
|
|
||||||
TORRENT_ASSERT(m_listen_interface.port() > 0);
|
|
||||||
m_dht_settings.service_port = m_listen_interface.port();
|
m_dht_settings.service_port = m_listen_interface.port();
|
||||||
|
else
|
||||||
|
m_dht_settings.service_port = 45000 + (rand() % 10000);
|
||||||
}
|
}
|
||||||
m_external_udp_port = m_dht_settings.service_port;
|
m_external_udp_port = m_dht_settings.service_port;
|
||||||
if (m_natpmp.get() && m_udp_mapping[0] == -1)
|
if (m_natpmp.get() && m_udp_mapping[0] == -1)
|
||||||
|
@ -761,7 +761,7 @@ namespace libtorrent
|
|||||||
// we're done, or encounter a failure
|
// we're done, or encounter a failure
|
||||||
if (ret == piece_manager::need_full_check) return;
|
if (ret == piece_manager::need_full_check) return;
|
||||||
|
|
||||||
m_ses.done_checking(shared_from_this());
|
if (!m_abort) m_ses.done_checking(shared_from_this());
|
||||||
files_checked();
|
files_checked();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,8 +886,9 @@ namespace libtorrent
|
|||||||
if (req.left == -1) req.left = 16*1024;
|
if (req.left == -1) req.left = 16*1024;
|
||||||
req.event = e;
|
req.event = e;
|
||||||
tcp::endpoint ep = m_ses.get_ipv6_interface();
|
tcp::endpoint ep = m_ses.get_ipv6_interface();
|
||||||
|
error_code ec;
|
||||||
if (ep != tcp::endpoint())
|
if (ep != tcp::endpoint())
|
||||||
req.ipv6 = ep.address().to_string();
|
req.ipv6 = ep.address().to_string(ec);
|
||||||
|
|
||||||
req.url = m_trackers[m_currently_trying_tracker].url;
|
req.url = m_trackers[m_currently_trying_tracker].url;
|
||||||
// if we are aborting. we don't want any new peers
|
// if we are aborting. we don't want any new peers
|
||||||
@ -1064,7 +1065,8 @@ namespace libtorrent
|
|||||||
if (m_ses.m_ip_filter.access(host->endpoint().address()) & ip_filter::blocked)
|
if (m_ses.m_ip_filter.access(host->endpoint().address()) & ip_filter::blocked)
|
||||||
{
|
{
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||||
debug_log("blocked ip from tracker: " + host->endpoint().address().to_string());
|
error_code ec;
|
||||||
|
debug_log("blocked ip from tracker: " + host->endpoint().address().to_string(ec));
|
||||||
#endif
|
#endif
|
||||||
if (m_ses.m_alerts.should_post<peer_blocked_alert>())
|
if (m_ses.m_alerts.should_post<peer_blocked_alert>())
|
||||||
{
|
{
|
||||||
@ -1600,6 +1602,9 @@ namespace libtorrent
|
|||||||
m_storage->async_release_files(
|
m_storage->async_release_files(
|
||||||
bind(&torrent::on_files_released, shared_from_this(), _1, _2));
|
bind(&torrent::on_files_released, shared_from_this(), _1, _2));
|
||||||
|
|
||||||
|
if (m_state == torrent_status::checking_files)
|
||||||
|
m_ses.done_checking(shared_from_this());
|
||||||
|
|
||||||
m_owning_storage = 0;
|
m_owning_storage = 0;
|
||||||
m_host_resolver.cancel();
|
m_host_resolver.cancel();
|
||||||
}
|
}
|
||||||
@ -2379,9 +2384,15 @@ namespace libtorrent
|
|||||||
|| p->in_handshake()
|
|| p->in_handshake()
|
||||||
|| p->remote().address().is_v6()) return;
|
|| p->remote().address().is_v6()) return;
|
||||||
|
|
||||||
m_resolving_country = true;
|
|
||||||
asio::ip::address_v4 reversed(swap_bytes(p->remote().address().to_v4().to_ulong()));
|
asio::ip::address_v4 reversed(swap_bytes(p->remote().address().to_v4().to_ulong()));
|
||||||
tcp::resolver::query q(reversed.to_string() + ".zz.countries.nerd.dk", "0");
|
error_code ec;
|
||||||
|
tcp::resolver::query q(reversed.to_string(ec) + ".zz.countries.nerd.dk", "0");
|
||||||
|
if (ec)
|
||||||
|
{
|
||||||
|
p->set_country("!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_resolving_country = true;
|
||||||
m_host_resolver.async_resolve(q,
|
m_host_resolver.async_resolve(q,
|
||||||
bind(&torrent::on_country_lookup, shared_from_this(), _1, _2, p));
|
bind(&torrent::on_country_lookup, shared_from_this(), _1, _2, p));
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,7 @@ namespace libtorrent
|
|||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
#ifdef BOOST_NO_EXCEPTIONS
|
#ifdef BOOST_NO_EXCEPTIONS
|
||||||
const static torrent_info empty;
|
const static torrent_info empty(sha1_hash(0));
|
||||||
#endif
|
#endif
|
||||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||||
if (!t)
|
if (!t)
|
||||||
@ -540,7 +540,7 @@ namespace libtorrent
|
|||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
entry ret(entry::dictionary_t);
|
entry ret(entry::dictionary_t);
|
||||||
TORRENT_FORWARD(write_resume_data(ret));
|
TORRENT_FORWARD_RETURN2(write_resume_data(ret), ret);
|
||||||
t->filesystem().write_resume_data(ret);
|
t->filesystem().write_resume_data(ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user