mirror of
https://github.com/transmission/transmission
synced 2025-02-04 13:32:19 +00:00
use a while loop, not a for loop, for checking torrents when quitting
This commit is contained in:
parent
c1ada1f86b
commit
15aa8d8840
1 changed files with 8 additions and 8 deletions
|
@ -327,20 +327,20 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
|
||||
//wait for running transfers to stop (5 seconds timeout)
|
||||
NSDate * start = [NSDate date];
|
||||
Torrent * torrent;
|
||||
BOOL timeUp = NO;
|
||||
int i;
|
||||
for (i = 0; i < [fTorrents count]; i++)
|
||||
{
|
||||
if (timeUp)
|
||||
break;
|
||||
|
||||
torrent = [fTorrents objectAtIndex: i];
|
||||
while (!(timeUp = [start timeIntervalSinceNow] <= -5.0) && ![torrent isPaused])
|
||||
NSEnumerator * enumerator = [fTorrents objectEnumerator];
|
||||
Torrent * torrent;
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
{
|
||||
while (![torrent isPaused] && !(timeUp = [start timeIntervalSinceNow] < -5.0))
|
||||
{
|
||||
usleep(100000);
|
||||
[torrent update];
|
||||
}
|
||||
|
||||
if (timeUp)
|
||||
break;
|
||||
}
|
||||
[fTorrents release];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue