Fetch metadata of stopped magnets

This commit is contained in:
Guido Cella 2019-12-15 17:18:11 +01:00
parent 44fc571a67
commit d3c55f2b0e
3 changed files with 13 additions and 3 deletions

View File

@ -339,7 +339,7 @@ void tr_torrentSetMetadataPiece(tr_torrent* tor, int piece, void const* data, in
tor->incompleteMetadata = NULL;
tor->isStopping = true;
tor->magnetVerify = true;
tor->startAfterVerify = true;
tor->startAfterVerify = !tor->prefetchMagnetMetadata;
tr_torrentMarkEdited(tor);
}
else /* drat. */

View File

@ -1058,8 +1058,16 @@ static void torrentInit(tr_torrent* tor, tr_ctor const* ctor)
if (isNewTorrent)
{
tor->startAfterVerify = doStart;
tr_torrentVerify(tor, NULL, NULL);
if (!tr_torrentHasMetadata(tor) && !doStart)
{
tor->prefetchMagnetMetadata = true;
tr_torrentStartNow(tor);
}
else
{
tor->startAfterVerify = doStart;
tr_torrentVerify(tor, NULL, NULL);
}
}
else if (doStart)
{
@ -2058,6 +2066,7 @@ void tr_torrentStop(tr_torrent* tor)
tor->isRunning = false;
tor->isStopping = false;
tor->prefetchMagnetMetadata = false;
tr_torrentSetDirty(tor);
tr_runInEventThread(tor->session, stopTorrent, tor);

View File

@ -225,6 +225,7 @@ struct tr_torrent
bool isDirty;
bool isQueued;
bool prefetchMagnetMetadata;
bool magnetVerify;
bool infoDictOffsetIsCached;