Torrents that have errors aren't counted in the queue, and when a torrent encounters an error the next torrent in the queue will start (even though that torrent might still be active).

This commit is contained in:
Mitchell Livingston 2006-09-29 05:30:36 +00:00
parent c9819b2694
commit ce013148b0
3 changed files with 21 additions and 8 deletions

View File

@ -1420,7 +1420,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
if ([torrent isActive]) if ([torrent isActive])
{ {
if (![torrent isSeeding]) if (![torrent isSeeding] && ![torrent isError])
{ {
desiredActive--; desiredActive--;
if (desiredActive <= 0) if (desiredActive <= 0)
@ -1507,7 +1507,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
NSEnumerator * enumerator = [fTorrents objectEnumerator]; NSEnumerator * enumerator = [fTorrents objectEnumerator];
Torrent * torrent; Torrent * torrent;
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
if ([torrent isActive] && ![torrent isSeeding]) if ([torrent isActive] && ![torrent isSeeding] && ![torrent isError])
{ {
desiredActive--; desiredActive--;
if (desiredActive <= 0) if (desiredActive <= 0)

View File

@ -49,7 +49,7 @@
int fStopRatioSetting; int fStopRatioSetting;
float fRatioLimit; float fRatioLimit;
BOOL fFinishedSeeding, fWaitToStart; BOOL fFinishedSeeding, fWaitToStart, fError;
int fOrderValue; int fOrderValue;
} }

View File

@ -261,9 +261,21 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
break; break;
} }
if( fStat->error & TR_ETRACKER ) if (fStat->error & TR_ETRACKER)
[fStatusString setString: [@"Error: " stringByAppendingString: {
[NSString stringWithUTF8String: fStat->trackerError]]]; [fStatusString setString: [@"Error: " stringByAppendingString: [NSString stringWithUTF8String: fStat->trackerError]]];
if (!fError && [self isActive])
{
fError = YES;
if (![self isSeeding])
[[NSNotificationCenter defaultCenter] postNotificationName: @"StoppedDownloading" object: self];
}
}
else
{
if (fError)
fError = NO;
}
if ([self isActive]) if ([self isActive])
{ {
@ -329,6 +341,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (void) stopTransfer - (void) stopTransfer
{ {
fError = NO;
if ([self isActive]) if ([self isActive])
{ {
BOOL wasSeeding = [self isSeeding]; BOOL wasSeeding = [self isSeeding];
@ -430,8 +444,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
NSLog(@"Volume: %@", volume); NSLog(@"Volume: %@", volume);
NSLog(@"Remaining disk space: %qu (%@)", remainingSpace, [NSString stringForFileSize: remainingSpace]); NSLog(@"Remaining disk space: %qu (%@)", remainingSpace, [NSString stringForFileSize: remainingSpace]);
NSLog(@"Progress: %f", [self progress]);
NSLog(@"Torrent total size: %qu (%@)", [self size], [NSString stringForFileSize: [self size]]);
NSLog(@"Torrent remaining size: %qu (%@)", torrentRemaining, [NSString stringForFileSize: torrentRemaining]); NSLog(@"Torrent remaining size: %qu (%@)", torrentRemaining, [NSString stringForFileSize: torrentRemaining]);
if (volume && remainingSpace <= torrentRemaining) if (volume && remainingSpace <= torrentRemaining)
@ -790,6 +802,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
fWaitToStart = waitToStart ? [waitToStart boolValue] : [fDefaults boolForKey: @"AutoStartDownload"]; fWaitToStart = waitToStart ? [waitToStart boolValue] : [fDefaults boolForKey: @"AutoStartDownload"];
fOrderValue = orderValue ? [orderValue intValue] : tr_torrentCount(fLib) - 1; fOrderValue = orderValue ? [orderValue intValue] : tr_torrentCount(fLib) - 1;
fError = NO;
NSString * fileType = fInfo->multifile ? NSFileTypeForHFSTypeCode('fldr') : [[self name] pathExtension]; NSString * fileType = fInfo->multifile ? NSFileTypeForHFSTypeCode('fldr') : [[self name] pathExtension];
fIcon = [[NSWorkspace sharedWorkspace] iconForFileType: fileType]; fIcon = [[NSWorkspace sharedWorkspace] iconForFileType: fileType];