forked from premiere/premiere-libtorrent
fixed stale state when switching from finished to downloading
This commit is contained in:
parent
b859942369
commit
5840a50d79
|
@ -481,6 +481,11 @@ namespace libtorrent
|
|||
// completed() is called immediately after it.
|
||||
void finished();
|
||||
|
||||
// This is the opposite of finished. It is called if we used
|
||||
// to be finished but enabled some files for download so that
|
||||
// we wasn't finished anymore.
|
||||
void resume_download();
|
||||
|
||||
void async_verify_piece(int piece_index, boost::function<void(int)> const&);
|
||||
|
||||
// this is called from the peer_connection
|
||||
|
|
|
@ -1653,6 +1653,8 @@ namespace libtorrent
|
|||
// the torrent just became finished
|
||||
if (is_finished() && !was_finished)
|
||||
finished();
|
||||
else if (!is_finished() && was_finished)
|
||||
resume_download();
|
||||
}
|
||||
|
||||
void torrent::filter_piece(int index, bool filter)
|
||||
|
@ -2964,7 +2966,7 @@ namespace libtorrent
|
|||
{
|
||||
peer_connection* p = *i;
|
||||
TORRENT_ASSERT(p->associated_torrent().lock().get() == this);
|
||||
if (p->is_seed())
|
||||
if (p->upload_only())
|
||||
{
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
(*p->m_logger) << "*** SEED, CLOSING CONNECTION\n";
|
||||
|
@ -2980,7 +2982,16 @@ namespace libtorrent
|
|||
m_storage->async_release_files(
|
||||
bind(&torrent::on_files_released, shared_from_this(), _1, _2));
|
||||
}
|
||||
|
||||
// this is called when we were finished, but some files were
|
||||
// marked for downloading, and we are no longer finished
|
||||
void torrent::resume_download()
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
m_state = torrent_status::downloading;
|
||||
}
|
||||
|
||||
// called when torrent is complete (all pieces downloaded)
|
||||
void torrent::completed()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue