Now stop discovery when pairing

This commit is contained in:
Diego Waxemberg
2015-01-02 23:57:11 -05:00
parent 5aeedb894a
commit f0b145c01a
3 changed files with 12 additions and 3 deletions

View File

@@ -21,6 +21,7 @@
- (id) initWithHosts:(NSArray*)hosts andCallback:(id<DiscoveryCallback>) callback;
- (void) startDiscovery;
- (void) stopDiscovery;
- (void) stopDiscoveryBlocking;
- (BOOL) addHostToDiscovery:(Host*)host;
- (void) removeHostFromDiscovery:(Host*)host;
- (void) discoverHost:(NSString*)hostAddress withCallback:(void (^)(Host*))callback;

View File

@@ -69,8 +69,14 @@
[_mdnsMan stopSearching];
[_opQueue cancelAllOperations];
}
- (void) stopDiscoveryBlocking {
NSLog(@"Stopping discovery and waiting for workers to stop");
shouldDiscover = NO;
[_mdnsMan stopSearching];
[_opQueue cancelAllOperations];
[_opQueue waitUntilAllOperationsAreFinished];
NSLog(@"All discovery workers stopped");
}
- (BOOL) addHostToDiscovery:(Host *)host {