mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
Display a dialog if DNS resolution fails
This commit is contained in:
@@ -67,7 +67,7 @@
|
|||||||
return addr;
|
return addr;
|
||||||
} else {
|
} else {
|
||||||
NSLog(@"Failed to resolve host: %d", h_errno);
|
NSLog(@"Failed to resolve host: %d", h_errno);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ static StreamConfiguration* streamConfig;
|
|||||||
NSString* uniqueId = [CryptoManager getUniqueID];
|
NSString* uniqueId = [CryptoManager getUniqueID];
|
||||||
NSData* cert = [CryptoManager readCertFromFile];
|
NSData* cert = [CryptoManager readCertFromFile];
|
||||||
|
|
||||||
|
if ([Utils resolveHost:_selectedHost.hostName] == 0) {
|
||||||
|
[self displayDnsFailedDialog];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HttpManager* hMan = [[HttpManager alloc] initWithHost:_selectedHost.hostName uniqueId:uniqueId deviceName:@"roth" cert:cert];
|
HttpManager* hMan = [[HttpManager alloc] initWithHost:_selectedHost.hostName uniqueId:uniqueId deviceName:@"roth" cert:cert];
|
||||||
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:cert callback:self];
|
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:cert callback:self];
|
||||||
|
|
||||||
@@ -73,6 +78,14 @@ static StreamConfiguration* streamConfig;
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)displayDnsFailedDialog {
|
||||||
|
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Network Error"
|
||||||
|
message:@"Failed to resolve host."
|
||||||
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:nil]];
|
||||||
|
[self presentViewController:alert animated:YES completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)StreamButton:(UIButton *)sender
|
- (void)StreamButton:(UIButton *)sender
|
||||||
{
|
{
|
||||||
NSLog(@"Stream Button Pressed!");
|
NSLog(@"Stream Button Pressed!");
|
||||||
@@ -89,6 +102,10 @@ static StreamConfiguration* streamConfig;
|
|||||||
streamConfig = [[StreamConfiguration alloc] init];
|
streamConfig = [[StreamConfiguration alloc] init];
|
||||||
streamConfig.host = _selectedHost.hostName;
|
streamConfig.host = _selectedHost.hostName;
|
||||||
streamConfig.hostAddr = [Utils resolveHost:_selectedHost.hostName];
|
streamConfig.hostAddr = [Utils resolveHost:_selectedHost.hostName];
|
||||||
|
if (streamConfig.hostAddr == 0) {
|
||||||
|
[self displayDnsFailedDialog];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned long selectedConf = [self.StreamConfigs selectedRowInComponent:0];
|
unsigned long selectedConf = [self.StreamConfigs selectedRowInComponent:0];
|
||||||
NSLog(@"selectedConf: %ld", selectedConf);
|
NSLog(@"selectedConf: %ld", selectedConf);
|
||||||
|
|||||||
Reference in New Issue
Block a user