anonymous mode should default to false. minor fixes

This commit is contained in:
Arvid Norberg 2013-02-19 08:14:16 +00:00
parent 86a2569728
commit 5cf8aa57f4
3 changed files with 9 additions and 4 deletions

View File

@ -1828,7 +1828,7 @@ namespace libtorrent
int piece_picker::blocks_in_piece(int index) const
{
TORRENT_ASSERT(index >= 0);
TORRENT_ASSERT(index < (int)m_piece_map.size());
TORRENT_ASSERT(index < (int)m_piece_map.size() || m_piece_map.empty());
if (index+1 == (int)m_piece_map.size())
return m_blocks_in_last_piece;
else

View File

@ -1247,7 +1247,7 @@ namespace libtorrent
, max_pex_peers(50)
, ignore_resume_timestamps(false)
, no_recheck_incomplete_resume(false)
, anonymous_mode(true)
, anonymous_mode(false)
, force_proxy(false)
, tick_interval(100)
, report_web_seed_downloads(true)

View File

@ -2063,6 +2063,13 @@ namespace aux {
if (connections_limit_changed) update_connections_limit();
if (unchoke_limit_changed) update_unchoke_limit();
bool anonymous_mode = (m_settings.anonymous_mode != s.anonymous_mode && s.anonymous_mode);
if (anonymous_mode)
{
m_settings.user_agent.clear();
url_random((char*)&m_peer_id[0], (char*)&m_peer_id[0] + 20);
}
bool force_proxy = (m_settings.force_proxy != s.force_proxy && s.force_proxy);
m_udp_socket.set_force_proxy(s.force_proxy);
@ -2071,8 +2078,6 @@ namespace aux {
// connections, except through a proxy.
if (force_proxy)
{
m_settings.user_agent.clear();
url_random((char*)&m_peer_id[0], (char*)&m_peer_id[0] + 20);
stop_lsd();
stop_upnp();
stop_natpmp();