mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
Ensure double-starting or stopping DiscoveryManager and MDNSManager doesn't cause side-effects, since we do this when Home is pressed while streaming
This commit is contained in:
@@ -23,6 +23,8 @@ static NSString* NV_SERVICE_TYPE = @"_nvstream._tcp";
|
||||
|
||||
self.callback = callback;
|
||||
|
||||
scanActive = FALSE;
|
||||
|
||||
mDNSBrowser = [[NSNetServiceBrowser alloc] init];
|
||||
[mDNSBrowser setDelegate:self];
|
||||
|
||||
@@ -33,12 +35,20 @@ static NSString* NV_SERVICE_TYPE = @"_nvstream._tcp";
|
||||
}
|
||||
|
||||
- (void) searchForHosts {
|
||||
if (scanActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log(LOG_I, @"Starting mDNS discovery");
|
||||
scanActive = TRUE;
|
||||
[mDNSBrowser searchForServicesOfType:NV_SERVICE_TYPE inDomain:@""];
|
||||
}
|
||||
|
||||
- (void) stopSearching {
|
||||
if (!scanActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log(LOG_I, @"Stopping mDNS discovery");
|
||||
scanActive = FALSE;
|
||||
[mDNSBrowser stop];
|
||||
|
||||
Reference in New Issue
Block a user