forked from premiere/premiere-libtorrent
make tick interval configurable
This commit is contained in:
parent
feaf4aa082
commit
d0f2b0ade0
|
@ -3896,6 +3896,7 @@ session_settings
|
||||||
bool broadcast_lsd;
|
bool broadcast_lsd;
|
||||||
bool ignore_resume_timestamps;
|
bool ignore_resume_timestamps;
|
||||||
bool anonymous_mode;
|
bool anonymous_mode;
|
||||||
|
int tick_interval;
|
||||||
};
|
};
|
||||||
|
|
||||||
``user_agent`` this is the client identification to the tracker.
|
``user_agent`` this is the client identification to the tracker.
|
||||||
|
@ -4548,6 +4549,12 @@ when this setting is enabled.
|
||||||
|
|
||||||
If you're using I2P, it might make sense to enable anonymous mode as well.
|
If you're using I2P, it might make sense to enable anonymous mode as well.
|
||||||
|
|
||||||
|
``tick_interval`` specifies the number of milliseconds between internal
|
||||||
|
ticks. This is the frequency with which bandwidth quota is distributed to
|
||||||
|
peers. It should not be more than one second (i.e. 1000 ms). Setting this
|
||||||
|
to a low value (around 100) means higher resolution bandwidth quota distribution,
|
||||||
|
setting it to a higher value saves CPU cycles.
|
||||||
|
|
||||||
pe_settings
|
pe_settings
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,7 @@ namespace libtorrent
|
||||||
, broadcast_lsd(false)
|
, broadcast_lsd(false)
|
||||||
, ignore_resume_timestamps(false)
|
, ignore_resume_timestamps(false)
|
||||||
, anonymous_mode(false)
|
, anonymous_mode(false)
|
||||||
|
, tick_interval(100)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// this is the user agent that will be sent to the tracker
|
// this is the user agent that will be sent to the tracker
|
||||||
|
@ -824,6 +825,10 @@ namespace libtorrent
|
||||||
// mode is assumed to be combined with using a proxy for all your
|
// mode is assumed to be combined with using a proxy for all your
|
||||||
// traffic. With this option, your true IP address will not be exposed
|
// traffic. With this option, your true IP address will not be exposed
|
||||||
bool anonymous_mode;
|
bool anonymous_mode;
|
||||||
|
|
||||||
|
// the number of milliseconds between internal ticks. Should be no
|
||||||
|
// more than one second (i.e. 1000).
|
||||||
|
int tick_interval;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
|
|
|
@ -318,6 +318,7 @@ namespace aux {
|
||||||
TORRENT_SETTING(boolean, broadcast_lsd)
|
TORRENT_SETTING(boolean, broadcast_lsd)
|
||||||
TORRENT_SETTING(boolean, ignore_resume_timestamps)
|
TORRENT_SETTING(boolean, ignore_resume_timestamps)
|
||||||
TORRENT_SETTING(boolean, anonymous_mode)
|
TORRENT_SETTING(boolean, anonymous_mode)
|
||||||
|
TORRENT_SETTING(integer, tick_interval)
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef TORRENT_SETTING
|
#undef TORRENT_SETTING
|
||||||
|
@ -722,7 +723,7 @@ namespace aux {
|
||||||
|
|
||||||
url_random((char*)&m_peer_id[print.length()], (char*)&m_peer_id[0] + 20);
|
url_random((char*)&m_peer_id[print.length()], (char*)&m_peer_id[0] + 20);
|
||||||
|
|
||||||
m_timer.expires_from_now(milliseconds(100), ec);
|
m_timer.expires_from_now(milliseconds(m_settings.tick_interval), ec);
|
||||||
m_timer.async_wait(boost::bind(&session_impl::on_tick, this, _1));
|
m_timer.async_wait(boost::bind(&session_impl::on_tick, this, _1));
|
||||||
|
|
||||||
int delay = (std::max)(m_settings.local_service_announce_interval
|
int delay = (std::max)(m_settings.local_service_announce_interval
|
||||||
|
@ -1903,7 +1904,7 @@ namespace aux {
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_timer.expires_at(now + milliseconds(100), ec);
|
m_timer.expires_at(now + milliseconds(m_settings.tick_interval), ec);
|
||||||
m_timer.async_wait(bind(&session_impl::on_tick, this, _1));
|
m_timer.async_wait(bind(&session_impl::on_tick, this, _1));
|
||||||
|
|
||||||
m_download_rate.update_quotas(now - m_last_tick);
|
m_download_rate.update_quotas(now - m_last_tick);
|
||||||
|
|
Loading…
Reference in New Issue