Speed up PC polling by only trying once if the remote and local IPs are the same

This commit is contained in:
Cameron Gutman 2014-09-27 15:43:43 -07:00
parent a3106bffca
commit 36664133f8

View File

@ -342,7 +342,7 @@ public class ComputerManagerService extends Service {
polledDetails = tryPollIp(details.remoteIp); polledDetails = tryPollIp(details.remoteIp);
} }
if (polledDetails == null) { if (polledDetails == null && !details.localIp.equals(details.remoteIp)) {
// Failed, so let's try the fallback // Failed, so let's try the fallback
if (!localFirst) { if (!localFirst) {
polledDetails = tryPollIp(details.localIp); polledDetails = tryPollIp(details.localIp);
@ -356,7 +356,8 @@ public class ComputerManagerService extends Service {
polledDetails.reachability = !localFirst ? ComputerDetails.Reachability.LOCAL : polledDetails.reachability = !localFirst ? ComputerDetails.Reachability.LOCAL :
ComputerDetails.Reachability.REMOTE; ComputerDetails.Reachability.REMOTE;
} }
} else { }
else if (polledDetails != null) {
polledDetails.reachability = localFirst ? ComputerDetails.Reachability.LOCAL : polledDetails.reachability = localFirst ? ComputerDetails.Reachability.LOCAL :
ComputerDetails.Reachability.REMOTE; ComputerDetails.Reachability.REMOTE;
} }