From b342c2c18033a5534085c020e31f67cf4f866c80 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Sun, 19 Jan 2014 05:03:27 +0000 Subject: [PATCH] (trunk, libT) #4089: 'magnet download not verified for existing data' -- patch by cfpp2p --- libtransmission/torrent-magnet.c | 3 +++ libtransmission/torrent.c | 9 +++++++++ libtransmission/torrent.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/libtransmission/torrent-magnet.c b/libtransmission/torrent-magnet.c index e063071fc..cf91d0e01 100644 --- a/libtransmission/torrent-magnet.c +++ b/libtransmission/torrent-magnet.c @@ -299,6 +299,9 @@ tr_torrentSetMetadataPiece (tr_torrent * tor, int piece, const void * data, in { incompleteMetadataFree (tor->incompleteMetadata); tor->incompleteMetadata = NULL; + tor->isStopping = true; + tor->magnetVerify = true; + tor->startAfterVerify = true; } else /* drat. */ { diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index f02ada4e5..224721a3e 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1873,6 +1873,14 @@ stopTorrent (void * vtor) torrentSetQueued (tor, false); tr_torrentUnlock (tor); + + if (tor->magnetVerify) + { + tor->magnetVerify = false; + tr_logAddTorInfo (tor, "%s", "Magnet Verify"); + refreshCurrentDir (tor); + tr_torrentVerify (tor, NULL, NULL); + } } void @@ -1907,6 +1915,7 @@ closeTorrent (void * vtor) tr_logAddTorInfo (tor, "%s", _("Removing torrent")); + tor->magnetVerify = false; stopTorrent (tor); if (tor->isDeleting) diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index dcaa327d3..6028d273d 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -247,6 +247,8 @@ struct tr_torrent bool isDirty; bool isQueued; + bool magnetVerify; + bool infoDictOffsetIsCached; uint16_t maxConnectedPeers;