lt sync 2219
This commit is contained in:
parent
e477b5e037
commit
9f05f6fc64
|
@ -119,6 +119,19 @@ namespace
|
|||
s.start_upnp();
|
||||
return;
|
||||
}
|
||||
|
||||
list get_torrents(session& s)
|
||||
{
|
||||
list ret;
|
||||
std::vector<torrent_handle> torrents = s.get_torrents();
|
||||
|
||||
for (std::vector<torrent_handle>::iterator i = torrents.begin(); i != torrents.end(); ++i)
|
||||
{
|
||||
ret.append(*i);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_GEO_IP
|
||||
bool load_asnum_db(session& s, std::string file)
|
||||
{
|
||||
|
@ -298,6 +311,8 @@ void bind_session()
|
|||
.def("start_natpmp", &start_natpmp, session_start_natpmp_doc)
|
||||
.def("stop_natpmp", allow_threads(&session::stop_natpmp), session_stop_natpmp_doc)
|
||||
.def("set_ip_filter", allow_threads(&session::set_ip_filter), session_set_ip_filter_doc)
|
||||
.def("find_torrent", allow_threads(&session::find_torrent))
|
||||
.def("get_torrents", &get_torrents)
|
||||
;
|
||||
|
||||
register_ptr_to_python<std::auto_ptr<alert> >();
|
||||
|
|
|
@ -203,6 +203,7 @@ namespace libtorrent
|
|||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_GEO_IP
|
||||
int as_for_ip(address const& addr);
|
||||
bool load_asnum_db(char const* file);
|
||||
bool load_country_db(char const* file);
|
||||
#endif
|
||||
|
|
|
@ -526,7 +526,14 @@ namespace libtorrent
|
|||
// optimization, don't send have messages
|
||||
// to peers that already have the piece
|
||||
if (!m_ses.settings().send_redundant_have
|
||||
&& has_piece(index)) return;
|
||||
&& has_piece(index))
|
||||
{
|
||||
#ifdef TORRENT_VERBOSE_LOGGING
|
||||
(*m_logger) << time_now_string()
|
||||
<< " ==> HAVE [ piece: " << index << " ] SUPRESSED\n";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TORRENT_VERBOSE_LOGGING
|
||||
(*m_logger) << time_now_string()
|
||||
|
|
|
@ -185,6 +185,13 @@ namespace libtorrent
|
|||
{
|
||||
return m_impl->load_country_db(file);
|
||||
}
|
||||
|
||||
int session::as_for_ip(address const& addr)
|
||||
{
|
||||
aux::session_impl::mutex_t::scoped_lock l(m_impl->m_mutex);
|
||||
return m_impl->as_for_ip(addr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void session::load_state(entry const& ses_state)
|
||||
|
|
|
@ -159,7 +159,7 @@ namespace aux {
|
|||
, m_num_unchoked(0)
|
||||
, m_unchoke_time_scaler(0)
|
||||
, m_optimistic_unchoke_time_scaler(0)
|
||||
, m_disconnect_time_scaler(0)
|
||||
, m_disconnect_time_scaler(90)
|
||||
, m_incoming_connection(false)
|
||||
, m_last_tick(time_now())
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
@ -1355,7 +1355,7 @@ namespace aux {
|
|||
--m_disconnect_time_scaler;
|
||||
if (m_disconnect_time_scaler <= 0)
|
||||
{
|
||||
m_disconnect_time_scaler = 60;
|
||||
m_disconnect_time_scaler = 90;
|
||||
|
||||
// every 60 seconds, disconnect the worst peer
|
||||
// if we have reached the connection limit
|
||||
|
@ -1366,6 +1366,7 @@ namespace aux {
|
|||
< bind(&torrent::num_peers, bind(&torrent_map::value_type::second, _2)));
|
||||
|
||||
TORRENT_ASSERT(i != m_torrents.end());
|
||||
// TODO: make the number of peers a percentage of the number of connected peers
|
||||
i->second->get_policy().disconnect_one_peer();
|
||||
}
|
||||
}
|
||||
|
@ -1565,13 +1566,6 @@ namespace aux {
|
|||
m_queued_for_checking.pop_front();
|
||||
if (!m_queued_for_checking.empty())
|
||||
m_queued_for_checking.front()->start_checking();
|
||||
|
||||
if (m_alerts.should_post(alert::info))
|
||||
{
|
||||
m_alerts.post_alert(torrent_checked_alert(
|
||||
t->get_handle()
|
||||
, "torrent finished checking"));
|
||||
}
|
||||
}
|
||||
|
||||
torrent_handle session_impl::add_torrent(
|
||||
|
|
|
@ -206,6 +206,10 @@ namespace libtorrent
|
|||
, m_max_connections((std::numeric_limits<int>::max)())
|
||||
, m_deficit_counter(0)
|
||||
, m_policy(this)
|
||||
, m_active_time(seconds(0))
|
||||
, m_seeding_time(seconds(0))
|
||||
, m_total_uploaded(0)
|
||||
, m_total_downloaded(0)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
m_files_checked = false;
|
||||
|
@ -271,6 +275,10 @@ namespace libtorrent
|
|||
, m_max_connections((std::numeric_limits<int>::max)())
|
||||
, m_deficit_counter(0)
|
||||
, m_policy(this)
|
||||
, m_active_time(seconds(0))
|
||||
, m_seeding_time(seconds(0))
|
||||
, m_total_uploaded(0)
|
||||
, m_total_downloaded(0)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
m_files_checked = false;
|
||||
|
@ -1149,7 +1157,9 @@ namespace libtorrent
|
|||
|
||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||
(*m_ses.m_logger) << time_now_string() << " *** PIECE_FINISHED [ p: "
|
||||
<< index << " chk: " << (passed_hash_check?"passed":"failed") << " ]\n";
|
||||
<< index << " chk: " << ((passed_hash_check == 0)
|
||||
?"passed":passed_hash_check == -1
|
||||
?"disk failed":"failed") << " ]\n";
|
||||
#endif
|
||||
|
||||
bool was_seed = is_seed();
|
||||
|
@ -2981,6 +2991,14 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ses.m_alerts.should_post(alert::info))
|
||||
{
|
||||
m_ses.m_alerts.post_alert(torrent_checked_alert(
|
||||
get_handle()
|
||||
, "torrent finished checking"));
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
m_files_checked = true;
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,8 @@ udp_socket::udp_socket(asio::io_service& ios, udp_socket::callback_t const& c
|
|||
|
||||
void udp_socket::send(udp::endpoint const& ep, char const* p, int len, asio::error_code& ec)
|
||||
{
|
||||
if (ec == asio::error::operation_aborted) return;
|
||||
|
||||
if (m_tunnel_packets)
|
||||
{
|
||||
// send udp packets through SOCKS5 server
|
||||
|
@ -39,6 +41,8 @@ void udp_socket::send(udp::endpoint const& ep, char const* p, int len, asio::err
|
|||
|
||||
void udp_socket::on_read(udp::socket* s, asio::error_code const& e, std::size_t bytes_transferred)
|
||||
{
|
||||
if (e == asio::error::operation_aborted) return;
|
||||
|
||||
if (!m_callback) return;
|
||||
|
||||
if (e)
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace libtorrent
|
|||
: tracker_connection(man, req, ios, bind_infc, c)
|
||||
, m_man(man)
|
||||
, m_name_lookup(ios)
|
||||
, m_socket(ios, boost::bind(&udp_tracker_connection::on_receive, this, _1, _2, _3, _4), cc)
|
||||
, m_socket(ios, boost::bind(&udp_tracker_connection::on_receive, self(), _1, _2, _3, _4), cc)
|
||||
, m_transaction_id(0)
|
||||
, m_connection_id(0)
|
||||
, m_settings(stn)
|
||||
|
|
Loading…
Reference in New Issue