most of the metadata is now freed when a torrent becomes a seed. #44

This commit is contained in:
Arvid Norberg
2007-05-09 22:54:26 +00:00
parent 6e7c0ebfc9
commit a5847956e1
5 changed files with 91 additions and 26 deletions

View File

@@ -106,7 +106,15 @@ namespace libtorrent { namespace
{
m_requested_metadata.resize(256, 0);
}
virtual void on_files_checked()
{
// if the torrent is a seed, copy the metadata from
// the torrent before it is deallocated
if (m_torrent.is_seed())
metadata();
}
virtual boost::shared_ptr<peer_plugin> new_connection(
peer_connection* pc);
@@ -211,6 +219,14 @@ namespace libtorrent { namespace
m_metadata_size = total_size;
}
void piece_pass(int)
{
// if we became a seed, copy the metadata from
// the torrent before it is deallocated
if (m_torrent.is_seed())
metadata();
}
private:
torrent& m_torrent;