Code: Select all
Index: quark.c
===================================================================
--- quark.c (revision 14206)
+++ quark.c (working copy)
@@ -277,6 +277,7 @@
{ "rename-partial-files", 20 },
{ "reqq", 4 },
{ "result", 6 },
+ { "reverify-torrents-tries", 23 },
{ "rpc-authentication-required", 27 },
{ "rpc-bind-address", 16 },
{ "rpc-enabled", 11 },
Index: session.c
===================================================================
--- session.c (revision 14206)
+++ session.c (working copy)
@@ -351,6 +351,7 @@
tr_variantDictAddReal (d, TR_KEY_ratio_limit, 2.0);
tr_variantDictAddBool (d, TR_KEY_ratio_limit_enabled, false);
tr_variantDictAddBool (d, TR_KEY_rename_partial_files, true);
+ tr_variantDictAddInt (d, TR_KEY_reverify_torrents, 0);
tr_variantDictAddBool (d, TR_KEY_rpc_authentication_required, false);
tr_variantDictAddStr (d, TR_KEY_rpc_bind_address, "0.0.0.0");
tr_variantDictAddBool (d, TR_KEY_rpc_enabled, false);
@@ -423,6 +424,7 @@
tr_variantDictAddReal (d, TR_KEY_ratio_limit, s->desiredRatio);
tr_variantDictAddBool (d, TR_KEY_ratio_limit_enabled, s->isRatioLimited);
tr_variantDictAddBool (d, TR_KEY_rename_partial_files, tr_sessionIsIncompleteFileNamingEnabled (s));
+ tr_variantDictAddInt (d, TR_KEY_reverify_torrents, s->reverifyTorrents);
tr_variantDictAddBool (d, TR_KEY_rpc_authentication_required, tr_sessionIsRPCPasswordEnabled (s));
tr_variantDictAddStr (d, TR_KEY_rpc_bind_address, tr_sessionGetRPCBindAddress (s));
tr_variantDictAddBool (d, TR_KEY_rpc_enabled, tr_sessionIsRPCEnabled (s));
@@ -812,6 +814,8 @@
tr_sessionSetDeleteSource (session, boolVal);
if (tr_variantDictFindInt (settings, TR_KEY_peer_id_ttl_hours, &i))
session->peer_id_ttl_hours = i;
+ if(tr_variantDictFindInt (settings, TR_KEY_reverify_torrents, &i))
+ session->reverifyTorrents = ( i > 0 ) ? i : 0 ;
/* torrent queues */
if (tr_variantDictFindInt (settings, TR_KEY_queue_stalled_minutes, &i))
Index: session.h
===================================================================
--- session.h (revision 14206)
+++ session.h (working copy)
@@ -120,6 +120,8 @@
uint8_t peer_id_ttl_hours;
+ int reverifyTorrents;
+
tr_variant removedTorrents;
bool stalledEnabled;
Index: torrent.c
===================================================================
--- torrent.c (revision 14206)
+++ torrent.c (working copy)
@@ -869,6 +869,7 @@
tor->uniqueId = nextUniqueId++;
tor->magicNumber = TORRENT_MAGIC_NUMBER;
tor->queuePosition = session->torrentCount;
+ tor->reverifyTorrent = tor->session->reverifyTorrents;
tr_sha1 (tor->obfuscatedHash, "req2", 4,
tor->info.hash, SHA_DIGEST_LENGTH,
@@ -2184,6 +2185,17 @@
tr_torrentCheckSeedLimit (tor);
}
+ if( tor->session->reverifyTorrents )
+ {
+ if( tor->reverifyTorrent-- )
+ tr_torrentVerify (tor, NULL, NULL);
+ else
+ {
+ tr_torrentSetLocalError (tor, "%s", _("Reverify count exceeded - pausing torrent -- resetting retries"));
+ tor->reverifyTorrent = tor->session->reverifyTorrents; /* reset reverify tries */
+ }
+ }
+
if (tr_sessionIsTorrentDoneScriptEnabled (tor->session))
torrentCallScript (tor, tr_sessionGetTorrentDoneScript (tor->session));
}
Index: torrent.h
===================================================================
--- torrent.h (revision 14206)
+++ torrent.h (working copy)
@@ -263,6 +263,8 @@
int uniqueId;
+ int reverifyTorrent;
+
struct tr_bandwidth bandwidth;
struct tr_swarm * swarm;