try to fix app crash caused by host discovery
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
NSError *error;
|
||||
parentHost.activeAddressPool = [NSKeyedArchiver archivedDataWithRootObject:self.activeAddressPool requiringSecureCoding:YES error:&error];
|
||||
}
|
||||
else [self.activeAddressPool addObject:self.activeAddress];
|
||||
else if(self.activeAddress) [self.activeAddressPool addObject:self.activeAddress];
|
||||
|
||||
// NSLog(@"Persisting activeAddressPool, pool count %lu ... %f, host: %@", (unsigned long)self.activeAddressPool.count, CACurrentMediaTime(), self.name);
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
host = [[TemporaryHost alloc] init];
|
||||
host.activeAddress = host.address = hostAddress;
|
||||
if(!host.activeAddressPool) host.activeAddressPool = [[NSMutableSet alloc] init];
|
||||
[host.activeAddressPool addObject:host.activeAddress];
|
||||
if(host.activeAddress) [host.activeAddressPool addObject:host.activeAddress];
|
||||
host.state = StateOnline;
|
||||
[serverInfoResponse populateHost:host];
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
existingHost.externalAddress = host.externalAddress;
|
||||
}
|
||||
existingHost.activeAddress = host.activeAddress;
|
||||
[existingHost.activeAddressPool addObject:host.activeAddress];
|
||||
if(host.activeAddress) [existingHost.activeAddressPool addObject:host.activeAddress];
|
||||
existingHost.state = host.state;
|
||||
return NO; // returning a "NO" here means Updating addresses of existing host
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ static const float POLL_RATE = 2.0f; // Poll every 2 seconds
|
||||
if (receivedResponse) {
|
||||
_host.activeAddress = address;
|
||||
if(!_host.activeAddressPool) _host.activeAddressPool = [[NSMutableSet alloc] init];
|
||||
[_host.activeAddressPool addObject:address];
|
||||
if(address) [_host.activeAddressPool addObject:address];
|
||||
[serverInfoResp populateHost:_host];
|
||||
|
||||
// Update the database using the response
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
// If we reached this host through this port, store our port there
|
||||
if (host.activeAddress && [lanAddr isEqualToString:[Utils addressPortStringToAddress:host.activeAddress]]) {
|
||||
localPort = [Utils addressPortStringToPort:host.activeAddress];
|
||||
[host.activeAddressPool addObject:host.activeAddress];
|
||||
if(host.activeAddress) [host.activeAddressPool addObject:host.activeAddress];
|
||||
}
|
||||
else if (host.localAddress) {
|
||||
// If there's an existing local address, use the port from that
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
|
||||
host.localAddress = [Utils addressAndPortToAddressPortString:lanAddr port:localPort];
|
||||
[host.activeAddressPool addObject:lanAddr];
|
||||
if(lanAddr) [host.activeAddressPool addObject:lanAddr];
|
||||
}
|
||||
|
||||
// This is a Sunshine extension for WAN port remapping
|
||||
|
||||
Reference in New Issue
Block a user