X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/4883c610168ebeb51a54ae8cce12d24638034b08..af1fcfcf8c78f03127d3929b49330cc191259487:/ITServiceBrowserDelegate.m?ds=sidebyside diff --git a/ITServiceBrowserDelegate.m b/ITServiceBrowserDelegate.m index 0dfcce8..6d368c6 100755 --- a/ITServiceBrowserDelegate.m +++ b/ITServiceBrowserDelegate.m @@ -15,21 +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 connectWithSockaddrArray:[aNetService addresses]]; + sock = [[ITInetSocket alloc] initWithDelegate:d]; + NSLog(@"Detected a service! name %@ type %@",[aNetService name],[aNetService type]); + arr = [aNetService addresses]; + if ([arr count]) + [sock connectWithSockaddrArray:arr]; + else + NSLog(@"There are no sockaddrs for this service!"); } @end