Changeset 12325


Ignore:
Timestamp:
Apr 5, 2011, 11:03:33 PM (11 years ago)
Author:
livings124
Message:

when removing trackers, handle hidden duplicates

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoTrackersViewController.m

    r12218 r12325  
    314314            {
    315315                Torrent * torrent = [(TrackerNode *)object torrent];
    316                 NSMutableIndexSet * removeIndexSet;
    317                 if (!(removeIndexSet = [removeIdentifiers objectForKey: torrent]))
     316                NSMutableSet * removeSet;
     317                if (!(removeSet = [removeIdentifiers objectForKey: torrent]))
    318318                {
    319                     removeIndexSet = [NSMutableIndexSet indexSet];
    320                     [removeIdentifiers setObject: removeIndexSet forKey: torrent];
     319                    removeSet = [NSMutableSet set];
     320                    [removeIdentifiers setObject: removeSet forKey: torrent];
    321321                }
    322322               
    323                 [removeIndexSet addIndex: [(TrackerNode *)object identifier]];
     323                [removeSet addObject: [(TrackerNode *)object fullAnnounceAddress]];
    324324                ++removeCount;
    325325            }
     
    371371   
    372372    for (Torrent * torrent in removeIdentifiers)
    373         [torrent removeTrackersWithIdentifiers: [removeIdentifiers objectForKey: torrent]];
     373        [torrent removeTrackers: [removeIdentifiers objectForKey: torrent]];
    374374   
    375375    //reset table with either new or old value
  • trunk/macosx/Torrent.h

    r12082 r12325  
    135135- (NSArray *) allTrackersFlat; //used by GroupRules
    136136- (BOOL) addTrackerToNewTier: (NSString *) tracker;
    137 - (void) removeTrackersWithIdentifiers: (NSIndexSet *) removeIdentifiers;
     137- (void) removeTrackers: (NSSet *) trackers;
    138138
    139139- (NSString *) comment;
  • trunk/macosx/Torrent.m

    r12245 r12325  
    700700}
    701701
    702 - (void) removeTrackersWithIdentifiers: (NSIndexSet *) removeIdentifiers
     702- (void) removeTrackers: (NSSet *) trackers
    703703{
    704704    //recreate the tracker structure
     
    708708    for (NSUInteger i = 0; i < fInfo->trackerCount; i++)
    709709    {
    710         if (![removeIdentifiers containsIndex: fInfo->trackers[i].id])
     710        if (![trackers containsObject: [NSString stringWithUTF8String: fInfo->trackers[i].announce]])
    711711            trackerStructs[newCount++] = fInfo->trackers[i];
    712712    }
Note: See TracChangeset for help on using the changeset viewer.