forked from premiere/premiere-libtorrent
optimized session/torrent startup time (shaved off about 2 seconds)
This commit is contained in:
parent
977c2d34dd
commit
643a49f022
|
@ -1,3 +1,4 @@
|
|||
* optimized session startup time
|
||||
* support SSL for web seeds, through all proxies
|
||||
* support extending web seeds with custom authorization and extra headers
|
||||
* settings that are not changed from the default values are not saved
|
||||
|
|
|
@ -457,7 +457,7 @@ namespace aux {
|
|||
, m_incoming_connection(false)
|
||||
, m_created(time_now_hires())
|
||||
, m_last_tick(m_created)
|
||||
, m_last_second_tick(m_created)
|
||||
, m_last_second_tick(m_created - milliseconds(900))
|
||||
, m_last_choke(m_created)
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
, m_dht_announce_timer(m_io_service)
|
||||
|
@ -2037,6 +2037,9 @@ namespace aux {
|
|||
// too expensive
|
||||
// INVARIANT_CHECK;
|
||||
|
||||
#if defined TORRENT_VERBOSE_LOGGING
|
||||
// (*m_logger) << time_now_string() << " session_impl::on_tick\n";
|
||||
#endif
|
||||
if (m_abort) return;
|
||||
|
||||
if (e == asio::error::operation_aborted) return;
|
||||
|
@ -2151,6 +2154,16 @@ namespace aux {
|
|||
<< std::endl;
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// auto managed torrent
|
||||
// --------------------------------------------------------------
|
||||
m_auto_manage_time_scaler--;
|
||||
if (m_auto_manage_time_scaler <= 0)
|
||||
{
|
||||
m_auto_manage_time_scaler = settings().auto_manage_interval;
|
||||
recalculate_auto_managed_torrents();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// check for incoming connections that might have timed out
|
||||
// --------------------------------------------------------------
|
||||
|
@ -2438,16 +2451,6 @@ namespace aux {
|
|||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// auto managed torrent
|
||||
// --------------------------------------------------------------
|
||||
m_auto_manage_time_scaler--;
|
||||
if (m_auto_manage_time_scaler <= 0)
|
||||
{
|
||||
m_auto_manage_time_scaler = settings().auto_manage_interval;
|
||||
recalculate_auto_managed_torrents();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// unchoke set calculations
|
||||
// --------------------------------------------------------------
|
||||
|
@ -2611,7 +2614,7 @@ namespace aux {
|
|||
--dht_limit;
|
||||
--tracker_limit;
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||
t->log_to_all_peers("AUTO MANAGER STARTING TORRENT");
|
||||
t->log_to_all_peers(("AUTO MANAGER STARTING TORRENT: " + t->torrent_file().name()).c_str());
|
||||
#endif
|
||||
t->set_announce_to_dht(dht_limit >= 0);
|
||||
t->set_announce_to_trackers(tracker_limit >= 0);
|
||||
|
@ -2620,7 +2623,7 @@ namespace aux {
|
|||
else
|
||||
{
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING || defined TORRENT_LOGGING
|
||||
t->log_to_all_peers("AUTO MANAGER PAUSING TORRENT");
|
||||
t->log_to_all_peers(("AUTO MANAGER PAUSING TORRENT: " + t->torrent_file().name()).c_str());
|
||||
#endif
|
||||
t->set_allow_peers(false);
|
||||
}
|
||||
|
|
|
@ -390,6 +390,10 @@ namespace libtorrent
|
|||
, m_downloaders(0xffffff)
|
||||
, m_interface_index(0)
|
||||
{
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
(*m_ses.m_logger) << time_now_string() << " creating torrent: "
|
||||
<< torrent_file().name() << "\n";
|
||||
#endif
|
||||
m_net_interfaces.push_back(tcp::endpoint(net_interface.address(), 0));
|
||||
|
||||
if (p.file_priorities)
|
||||
|
@ -428,6 +432,10 @@ namespace libtorrent
|
|||
|
||||
void torrent::start()
|
||||
{
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
(*m_ses.m_logger) << time_now_string() << " starting torrent: "
|
||||
<< torrent_file().name() << "\n";
|
||||
#endif
|
||||
TORRENT_ASSERT(!m_picker);
|
||||
|
||||
if (!m_seed_mode)
|
||||
|
@ -446,7 +454,7 @@ namespace libtorrent
|
|||
error_code ec(errors::parse_failed);
|
||||
m_ses.m_alerts.post_alert(fastresume_rejected_alert(get_handle(), ec));
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
(*m_ses.m_logger) << "fastresume data for "
|
||||
(*m_ses.m_logger) << time_now_string() << " fastresume data for "
|
||||
<< torrent_file().name() << " rejected: " << ec.message() << "\n";
|
||||
#endif
|
||||
}
|
||||
|
@ -933,7 +941,7 @@ namespace libtorrent
|
|||
if (ev)
|
||||
{
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
(*m_ses.m_logger) << "fastresume data for "
|
||||
(*m_ses.m_logger) << time_now_string() << " fastresume data for "
|
||||
<< torrent_file().name() << " rejected: "
|
||||
<< error_code(ev, get_libtorrent_category()).message() << "\n";
|
||||
#endif
|
||||
|
@ -1084,7 +1092,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
(*m_ses.m_logger) << "fastresume data for "
|
||||
(*m_ses.m_logger) << time_now_string() << " fastresume data for "
|
||||
<< torrent_file().name() << " rejected: "
|
||||
<< j.error.message() << " ret:" << ret << "\n";
|
||||
#endif
|
||||
|
|
|
@ -79,6 +79,8 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file
|
|||
}
|
||||
|
||||
add_torrent_params p;
|
||||
p.auto_managed = false;
|
||||
p.paused = false;
|
||||
p.ti = torrent_file;
|
||||
p.save_path = "./tmp2_web_seed";
|
||||
p.storage_mode = storage_mode_compact;
|
||||
|
|
Loading…
Reference in New Issue