use a while loop, not a for loop, for checking torrents when quitting
This commit is contained in:
parent
c1ada1f86b
commit
15aa8d8840
|
@ -327,20 +327,20 @@ static void sleepCallBack(void * controller, io_service_t y,
|
||||||
|
|
||||||
//wait for running transfers to stop (5 seconds timeout)
|
//wait for running transfers to stop (5 seconds timeout)
|
||||||
NSDate * start = [NSDate date];
|
NSDate * start = [NSDate date];
|
||||||
Torrent * torrent;
|
|
||||||
BOOL timeUp = NO;
|
BOOL timeUp = NO;
|
||||||
int i;
|
|
||||||
for (i = 0; i < [fTorrents count]; i++)
|
|
||||||
{
|
|
||||||
if (timeUp)
|
|
||||||
break;
|
|
||||||
|
|
||||||
torrent = [fTorrents objectAtIndex: i];
|
NSEnumerator * enumerator = [fTorrents objectEnumerator];
|
||||||
while (!(timeUp = [start timeIntervalSinceNow] <= -5.0) && ![torrent isPaused])
|
Torrent * torrent;
|
||||||
|
while ((torrent = [enumerator nextObject]))
|
||||||
|
{
|
||||||
|
while (![torrent isPaused] && !(timeUp = [start timeIntervalSinceNow] < -5.0))
|
||||||
{
|
{
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
[torrent update];
|
[torrent update];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeUp)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
[fTorrents release];
|
[fTorrents release];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue