mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-26 06:02:32 +00:00
Only mark a PC offline if server info failed after 3 straight tries
This commit is contained in:
parent
814470f4bf
commit
b495246f34
@ -87,20 +87,32 @@ static const float POLL_RATE = 2.0f; // Poll every 2 seconds
|
||||
|
||||
Log(LOG_D, @"%@ has %d unique addresses", _host.name, [addresses count]);
|
||||
|
||||
for (NSString *address in addresses) {
|
||||
if (self.cancelled) {
|
||||
// Get out without updating the status because
|
||||
// it might not have finished checking the various
|
||||
// addresses
|
||||
return;
|
||||
// Give the PC 3 tries to respond before declaring it offline
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (NSString *address in addresses) {
|
||||
if (self.cancelled) {
|
||||
// Get out without updating the status because
|
||||
// it might not have finished checking the various
|
||||
// addresses
|
||||
return;
|
||||
}
|
||||
|
||||
ServerInfoResponse* serverInfoResp = [self requestInfoAtAddress:address];
|
||||
receivedResponse = [self checkResponse:serverInfoResp];
|
||||
if (receivedResponse) {
|
||||
_host.activeAddress = address;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ServerInfoResponse* serverInfoResp = [self requestInfoAtAddress:address];
|
||||
receivedResponse = [self checkResponse:serverInfoResp];
|
||||
if (receivedResponse) {
|
||||
_host.activeAddress = address;
|
||||
Log(LOG_I, @"Received serverinfo response on try %d", i);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// Wait for one second then retry
|
||||
[NSThread sleepForTimeInterval:1];
|
||||
}
|
||||
}
|
||||
|
||||
_host.online = receivedResponse;
|
||||
|
Loading…
x
Reference in New Issue
Block a user