Changeset 511


Ignore:
Timestamp:
Jul 3, 2006, 11:12:14 AM (16 years ago)
Author:
livings124
Message:

use a while loop, not a for loop, for checking torrents when quitting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r510 r511  
    328328    //wait for running transfers to stop (5 seconds timeout)
    329329    NSDate * start = [NSDate date];
     330    BOOL timeUp = NO;
     331   
     332    NSEnumerator * enumerator = [fTorrents objectEnumerator];
    330333    Torrent * torrent;
    331     BOOL timeUp = NO;
    332     int i;
    333     for (i = 0; i < [fTorrents count]; i++)
    334     {
     334    while ((torrent = [enumerator nextObject]))
     335    {
     336        while (![torrent isPaused] && !(timeUp = [start timeIntervalSinceNow] < -5.0))
     337        {
     338            usleep(100000);
     339            [torrent update];
     340        }
     341       
    335342        if (timeUp)
    336343            break;
    337    
    338         torrent = [fTorrents objectAtIndex: i];
    339         while (!(timeUp = [start timeIntervalSinceNow] <= -5.0) && ![torrent isPaused])
    340         {
    341             usleep(100000);
    342             [torrent update];
    343         }
    344344    }
    345345    [fTorrents release];
Note: See TracChangeset for help on using the changeset viewer.