Start and stop transfers for launch/quit without performing checks for waiting transfers, etc. This should fix saving the incorrect states of running transfers between launches.
This commit is contained in:
parent
cb9a16a0bd
commit
e7ebf16d43
|
@ -302,7 +302,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
|
||||
- (void) applicationWillTerminate: (NSNotification *) notification
|
||||
{
|
||||
// Stop updating the interface
|
||||
//stop updating the interface
|
||||
[fTimer invalidate];
|
||||
|
||||
//save history
|
||||
|
@ -320,9 +320,9 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
if (fUpdateInProgress)
|
||||
return;
|
||||
|
||||
//stop running torrents and wait for them to stop (5 seconds timeout)
|
||||
[fTorrents makeObjectsPerformSelector: @selector(stopTransfer)];
|
||||
|
||||
//stop running transfers and wait for them to stop (5 seconds timeout)
|
||||
[fTorrents makeObjectsPerformSelector: @selector(stopTransferForQuit)];
|
||||
|
||||
NSDate * start = [NSDate date];
|
||||
Torrent * torrent;
|
||||
while ([fTorrents count] > 0)
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
- (void) update;
|
||||
- (void) startTransfer;
|
||||
- (void) stopTransfer;
|
||||
- (void) stopTransferForQuit;
|
||||
- (void) removeForever;
|
||||
- (void) sleep;
|
||||
- (void) wakeUp;
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
NSString * paused;
|
||||
if (!(paused = [history objectForKey: @"Paused"]) || [paused isEqualToString: @"NO"])
|
||||
[self startTransfer];
|
||||
tr_torrentStart(fHandle);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -251,6 +251,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) stopTransferForQuit
|
||||
{
|
||||
if ([self isActive])
|
||||
tr_torrentStop(fHandle);
|
||||
}
|
||||
|
||||
- (void) removeForever
|
||||
{
|
||||
if (fPrivateTorrent)
|
||||
|
@ -607,6 +613,7 @@
|
|||
|
||||
fWaitToStart = waitToStart ? [waitToStart boolValue]
|
||||
: ![[fDefaults stringForKey: @"StartSetting"] isEqualToString: @"Manual"];
|
||||
fOrderValue = orderValue ? [orderValue intValue] : tr_torrentCount(fLib) - 1;
|
||||
|
||||
NSString * fileType = fInfo->multifile ? NSFileTypeForHFSTypeCode('fldr') : [[self name] pathExtension];
|
||||
fIcon = [[NSWorkspace sharedWorkspace] iconForFileType: fileType];
|
||||
|
@ -617,8 +624,6 @@
|
|||
|
||||
fProgressString = [[NSMutableString alloc] initWithCapacity: 50];
|
||||
fStatusString = [[NSMutableString alloc] initWithCapacity: 75];
|
||||
|
||||
fOrderValue = orderValue ? [orderValue intValue] : tr_torrentCount(fLib) - 1;
|
||||
|
||||
[self update];
|
||||
return self;
|
||||
|
|
Loading…
Reference in New Issue