X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/1d23d1181a753fffef7a9d28db4b0b0546bd0032..3874de1f6137ae56ee5161d54ccc262b71eef884:/ITServiceBrowserDelegate.m diff --git a/ITServiceBrowserDelegate.m b/ITServiceBrowserDelegate.m index 31dde47..6d368c6 100755 --- a/ITServiceBrowserDelegate.m +++ b/ITServiceBrowserDelegate.m @@ -15,23 +15,36 @@ { if (self = [super init]) { - delegate = _delegate; + delegate = [_delegate retain]; } return self; } +- (void) dealloc +{ + [delegate release]; +} + - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing { ITInetSocket *sock; + NSArray *arr; + id d = delegate; if (!moreComing) { + NSLog(@"Nothing more coming"); + [[aNetService retain] autorelease]; [aNetServiceBrowser stop]; [aNetServiceBrowser release]; [self release]; } - sock = [[ITInetSocket alloc] initWithDelegate:delegate]; + sock = [[ITInetSocket alloc] initWithDelegate:d]; NSLog(@"Detected a service! name %@ type %@",[aNetService name],[aNetService type]); - [sock connectWithSockaddrArray:[aNetService addresses]]; + arr = [aNetService addresses]; + if ([arr count]) + [sock connectWithSockaddrArray:arr]; + else + NSLog(@"There are no sockaddrs for this service!"); } @end