Skip to content

Instantly share code, notes, and snippets.

@jackun
Last active March 27, 2020 23:13
Show Gist options
  • Save jackun/0ceef1fc17b5db5da173fb6e32be6b64 to your computer and use it in GitHub Desktop.
Save jackun/0ceef1fc17b5db5da173fb6e32be6b64 to your computer and use it in GitHub Desktop.
fix the pain of my existence
diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c
index 04dd922..7ab8583 100644
--- a/libtransmission/torrent.c
+++ b/libtransmission/torrent.c
@@ -842,7 +842,21 @@ setLocalErrorIfFilesDisappeared (tr_torrent * tor)
if (disappeared)
{
tr_deeplog_tor (tor, "%s", "[LAZY] uh oh, the files disappeared");
- tr_torrentSetLocalError (tor, "%s", _("No data found! Ensure your drives are connected or use \"Set Location\". To re-download, remove the torrent and re-add it."));
+ tr_torrentSetLocalError (tor, "%s", _("No data found! Ensure your drives are connected or use \"Set Location\". To re-download, remove/re-add the torrent OR re-verify."));
+ }
+
+ return disappeared;
+}
+
+static bool
+localErrFilesDisappearedUE (tr_torrent * tor)
+{
+ const bool disappeared = (tr_torrentHaveTotal (tor) > 0) && !hasAnyLocalData (tor);
+
+ if( disappeared )
+ {
+ tr_deeplog_tor (tor, "%s", "[LAZY] uh oh WARNING, the files disappeared");
+ tr_torrentSetLocalError (tor, "%s", _("WARNING! Possible user error! Files MAY HAVE disappeared! To IGNORE, after verify use Start/Resume Now"));
}
return disappeared;
@@ -1719,8 +1733,8 @@ torrentStart (tr_torrent * tor, bool bypass_queue)
break;
}
- /* don't allow the torrent to be started if the files disappeared */
- if (setLocalErrorIfFilesDisappeared (tor))
+ /* IGNORE the error and start if Start/Resume Now issued */
+ if (!bypass_queue && localErrFilesDisappearedUE (tor))
return;
/* otherwise, start it now... */
@@ -1814,10 +1828,10 @@ verifyTorrent (void * vdata)
tr_torrentStop (tor);
tor->startAfterVerify = startAfter;
- if (setLocalErrorIfFilesDisappeared (tor))
+ if (localErrFilesDisappearedUE (tor))
tor->startAfterVerify = false;
- else
- tr_verifyAdd (tor, onVerifyDone, data);
+
+ tr_verifyAdd (tor, onVerifyDone, data);
tr_sessionUnlock (tor->session);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment