fix magnet link start logic (#4528)
This commit is contained in:
parent
0493542f62
commit
1e988c9ce4
|
@ -312,7 +312,7 @@ void on_have_all_metainfo(tr_torrent* tor, tr_incomplete_metadata* m)
|
|||
tor->incompleteMetadata = nullptr;
|
||||
tor->isStopping = true;
|
||||
tor->magnetVerify = true;
|
||||
if (tor->session->shouldPauseAddedTorrents())
|
||||
if (tor->session->shouldPauseAddedTorrents() && !tor->magnetStartAfterVerify)
|
||||
{
|
||||
tor->startAfterVerify = false;
|
||||
}
|
||||
|
|
|
@ -1782,6 +1782,16 @@ void tr_torrentStartNow(tr_torrent* tor)
|
|||
}
|
||||
}
|
||||
|
||||
void tr_torrentStartMagnet(tr_torrent* tor)
|
||||
{
|
||||
if (tr_isTorrent(tor))
|
||||
{
|
||||
tor->magnetStartAfterVerify = true;
|
||||
tor->startAfterVerify = true;
|
||||
torrentStart(tor, {});
|
||||
}
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
namespace
|
||||
|
|
|
@ -904,6 +904,7 @@ public:
|
|||
bool isRunning = false;
|
||||
bool isStopping = false;
|
||||
bool startAfterVerify = false;
|
||||
bool magnetStartAfterVerify = false;
|
||||
|
||||
bool magnetVerify = false;
|
||||
|
||||
|
|
|
@ -601,6 +601,9 @@ void tr_sessionSetAntiBruteForceEnabled(tr_session* session, bool enabled);
|
|||
/** @brief Like `tr_torrentStart()`, but resumes right away regardless of the queues. */
|
||||
void tr_torrentStartNow(tr_torrent* tor);
|
||||
|
||||
/** @brief Like tr_torrentStart(), but sets magnetStartAfterVerify to true. */
|
||||
void tr_torrentStartMagnet(tr_torrent*);
|
||||
|
||||
/** @brief Return the queued torrent's position in the queue it's in. [0...n) */
|
||||
size_t tr_torrentGetQueuePosition(tr_torrent const* tor);
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ typedef NS_ENUM(NSUInteger, PopupPriority) {
|
|||
|
||||
if (self.fStartCheck.state == NSControlStateValueOn)
|
||||
{
|
||||
[self.torrent startTransfer];
|
||||
[self.torrent startMagnetTransferAfterMetaDownload];
|
||||
}
|
||||
|
||||
[self close];
|
||||
|
|
|
@ -43,6 +43,7 @@ extern NSString* const kTorrentDidChangeGroupNotification;
|
|||
- (void)startTransferIgnoringQueue:(BOOL)ignoreQueue;
|
||||
- (void)startTransferNoQueue;
|
||||
- (void)startTransfer;
|
||||
- (void)startMagnetTransferAfterMetaDownload;
|
||||
- (void)stopTransfer;
|
||||
- (void)startQueue;
|
||||
- (void)sleep;
|
||||
|
|
|
@ -276,6 +276,18 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error** error)
|
|||
[self startTransferIgnoringQueue:NO];
|
||||
}
|
||||
|
||||
- (void)startMagnetTransferAfterMetaDownload
|
||||
{
|
||||
if ([self alertForRemainingDiskSpace])
|
||||
{
|
||||
tr_torrentStartMagnet(self.fHandle);
|
||||
[self update];
|
||||
|
||||
//capture, specifically, stop-seeding settings changing to unlimited
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateOptions" object:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopTransfer
|
||||
{
|
||||
tr_torrentStop(self.fHandle);
|
||||
|
|
Loading…
Reference in New Issue