memory optimization to free piece hashes is now optional

This commit is contained in:
Arvid Norberg 2007-11-19 04:58:52 +00:00
parent a62ed2eed4
commit fd11e07a55
2 changed files with 11 additions and 2 deletions

View File

@ -115,6 +115,7 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_DHT
, use_dht_as_fallback(true)
#endif
, free_torrent_hashes(true)
{}
// this is the user agent that will be sent to the tracker
@ -281,6 +282,12 @@ namespace libtorrent
// tracker is online
bool use_dht_as_fallback;
#endif
// if this is true, the piece hashes will be freed, in order
// to save memory, once the torrent is seeding. This will
// make the get_torrent_info() function to return an incomplete
// torrent object that cannot be passed back to add_torrent()
bool free_torrent_hashes;
};
#ifndef TORRENT_DISABLE_DHT

View File

@ -1153,7 +1153,8 @@ namespace libtorrent
if (is_seed())
{
m_picker.reset();
m_torrent_file->seed_free();
if (m_ses.settings().free_torrent_hashes)
m_torrent_file->seed_free();
}
}
@ -2347,7 +2348,8 @@ namespace libtorrent
if (is_seed())
{
m_picker.reset();
m_torrent_file->seed_free();
if (m_ses.settings().free_torrent_hashes)
m_torrent_file->seed_free();
}
if (!m_connections_initialized)