*** empty log message ***

This commit is contained in:
Arvid Norberg 2005-06-10 23:12:50 +00:00
parent 2d4c01ec65
commit 1bc22888a8
5 changed files with 38 additions and 9 deletions

View File

@ -168,7 +168,6 @@ namespace libtorrent
// piece-block, or if it's queued for downloading by some client
// or if it already has been successfully downlloaded
bool is_downloading(piece_block block) const;
bool is_finished(piece_block block) const;
// marks this piece-block as queued for downloading

View File

@ -285,6 +285,12 @@ namespace libtorrent
// all seeds and let the tracker know we're finished.
void completed();
// this is called when the torrent has finished. i.e.
// all the pieces we have not filtered have been downloaded.
// If no pieces are filtered, this is called first and then
// completed() is called immediately after it.
void finished();
bool verify_piece(int piece_index);
// this is called from the peer_connection

View File

@ -640,10 +640,10 @@ namespace libtorrent
int incomplete = -1;
try { complete = e["complete"].integer(); }
catch(type_error& e) {}
catch(type_error&) {}
try { incomplete = e["incomplete"].integer(); }
catch(type_error& e) {}
catch(type_error&) {}
requester().tracker_response(m_req, peer_list, interval, complete
, incomplete);

View File

@ -992,6 +992,8 @@ namespace libtorrent
m_torrent->filesystem().write(&m_recv_buffer[9], p.piece, p.start, p.length);
bool was_seed = m_torrent->is_seed();
bool was_finished = picker.num_filtered() + m_torrent->num_pieces()
== m_torrent->torrent_file().num_pieces();
picker.mark_as_finished(block_finished, m_socket->sender());
@ -1004,6 +1006,17 @@ namespace libtorrent
if (verified)
{
m_torrent->announce_piece(p.piece);
assert(m_torrent->valid_metadata());
if (!was_finished
&& picker.num_filtered() + m_torrent->num_pieces()
== m_torrent->torrent_file().num_pieces())
{
// torrent finished
// i.e. all the pieces we're interested in have
// been downloaded. Release the files (they will open
// in read only mode if needed)
m_torrent->finished();
}
}
else
{

View File

@ -739,7 +739,8 @@ namespace libtorrent
}
}
void torrent::completed()
// called when torrent is finished (all interested pieces downloaded)
void torrent::finished()
{
if (alerts().should_post(alert::info))
{
@ -748,11 +749,9 @@ namespace libtorrent
, "torrent has finished downloading"));
}
// disconnect all seeds
for (peer_iterator i = m_connections.begin();
i != m_connections.end();
++i)
i != m_connections.end(); ++i)
{
assert(i->second->associated_torrent() == this);
if (i->second->is_seed())
@ -760,7 +759,19 @@ namespace libtorrent
}
m_storage->release_files();
}
// called when torrent is complete (all pieces downloaded)
void torrent::completed()
{
/*
if (alerts().should_post(alert::info))
{
alerts().post_alert(torrent_complete_alert(
get_handle()
, "torrent is complete"));
}
*/
// make the next tracker request
// be a completed-event
m_event = tracker_request::completed;