Bonjour/MYAddressLookup.m
changeset 45 8efb48eabd08
parent 31 1d6924779df7
child 46 50dc5502ef46
     1.1 --- a/Bonjour/MYAddressLookup.m	Wed Apr 29 13:29:31 2009 -0700
     1.2 +++ b/Bonjour/MYAddressLookup.m	Sun May 10 19:00:50 2009 -0700
     1.3 @@ -25,7 +25,7 @@
     1.4              return nil;
     1.5          }
     1.6          _hostname = [hostname copy];
     1.7 -        _addresses = [[NSMutableArray alloc] init];
     1.8 +        _addresses = [[NSMutableSet alloc] init];
     1.9      }
    1.10      return self;
    1.11  }
    1.12 @@ -62,10 +62,10 @@
    1.13      if (address) {
    1.14          if (flags & kDNSServiceFlagsAdd) {
    1.15              LogTo(DNS,@"%@ got %@ [TTL = %u]", self, address, ttl);
    1.16 -            [_addresses addObject: address];
    1.17 +            kvAddToSet(self, @"addresses", _addresses, address);
    1.18          } else {
    1.19              LogTo(DNS,@"%@ lost %@ [TTL = %u]", self, address, ttl);
    1.20 -            [_addresses removeObject: address];
    1.21 +            kvRemoveFromSet(self, @"addresses", _addresses, address);
    1.22          }
    1.23          [address release];
    1.24      }
    1.25 @@ -96,7 +96,7 @@
    1.26  
    1.27  
    1.28  - (DNSServiceErrorType) createServiceRef: (DNSServiceRef*)sdRefPtr {
    1.29 -    [_addresses removeAllObjects];
    1.30 +    kvSetSet(self, @"addresses", _addresses, nil);
    1.31      return DNSServiceGetAddrInfo(sdRefPtr,
    1.32                                   kDNSServiceFlagsShareConnection,
    1.33                                   _interfaceIndex, 0,