This commit is contained in:
Cœur 2024-05-06 18:15:28 -04:00 committed by GitHub
commit ef1bade5ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 17 deletions

View File

@ -381,14 +381,14 @@ static void removeKeRangerRansomware()
[NSValueTransformer setValueTransformer:iconTransformer forName:@"ExpandedPathToIconTransformer"];
}
void onStartQueue(tr_session* /*session*/, tr_torrent* tor, void* vself)
void onStartQueue(tr_session* /*session*/, tr_torrent* /*tor*/, void* /*vself*/)
{
auto* controller = (__bridge Controller*)(vself);
auto const hashstr = @(tr_torrentView(tor).hash_string);
dispatch_async(dispatch_get_main_queue(), ^{
auto* const torrent = [controller torrentForHash:hashstr];
[torrent startQueue];
//posting asynchronously with coalescing to prevent stack overflow on lots of torrents changing state at the same time
[NSNotificationQueue.defaultQueue enqueueNotification:[NSNotification notificationWithName:@"UpdateTorrentsState" object:nil]
postingStyle:NSPostASAP
coalesceMask:NSNotificationCoalescingOnName
forModes:nil];
});
}
@ -812,8 +812,7 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
[nc addObserver:self.fWindow selector:@selector(makeKeyWindow) name:@"MakeWindowKey" object:nil];
#warning rename
[nc addObserver:self selector:@selector(fullUpdateUI) name:@"UpdateQueue" object:nil];
[nc addObserver:self selector:@selector(fullUpdateUI) name:@"UpdateTorrentsState" object:nil];
[nc addObserver:self selector:@selector(applyFilter) name:@"ApplyFilter" object:nil];

View File

@ -463,7 +463,7 @@ typedef NS_ENUM(NSUInteger, FilePriorityMenuTag) { //
[FileRenameSheetController presentSheetForTorrent:torrent modalForWindow:self.fOutline.window completionHandler:^(BOOL didRename) {
if (didRename)
{
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateQueue" object:self];
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateTorrentsState" object:nil];
[NSNotificationCenter.defaultCenter postNotificationName:@"ResetInspector" object:self
userInfo:@{ @"Torrent" : torrent }];
}

View File

@ -879,7 +879,7 @@ static NSString* const kWebUIURLFormat = @"http://localhost:%ld/";
tr_sessionSetQueueEnabled(self.fHandle, TR_UP, [self.fDefaults boolForKey:@"QueueSeed"]);
//handle if any transfers switch from queued to paused
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateQueue" object:self];
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateTorrentsState" object:nil];
}
- (void)setQueueNumber:(id)sender

View File

@ -42,7 +42,6 @@ extern NSString* const kTorrentDidChangeGroupNotification;
- (void)startTransfer;
- (void)startMagnetTransferAfterMetaDownload;
- (void)stopTransfer;
- (void)startQueue;
- (void)sleep;
- (void)wakeUp;
- (void)idleLimitHit;

View File

@ -251,7 +251,7 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
if (wasTransmitting != self.transmitting)
{
//posting asynchronously with coalescing to prevent stack overflow on lots of torrents changing state at the same time
[NSNotificationQueue.defaultQueue enqueueNotification:[NSNotification notificationWithName:@"UpdateQueue" object:self]
[NSNotificationQueue.defaultQueue enqueueNotification:[NSNotification notificationWithName:@"UpdateTorrentsState" object:nil]
postingStyle:NSPostASAP
coalesceMask:NSNotificationCoalescingOnName
forModes:nil];
@ -1982,11 +1982,6 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
}];
}
- (void)startQueue
{
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateQueue" object:self];
}
- (void)completenessChange:(tr_completeness)status wasRunning:(BOOL)wasRunning
{
self.fStat = tr_torrentStat(self.fHandle); //don't call update yet to avoid auto-stop