Fix incorrectly persisting host with missing server cert

This commit is contained in:
Cameron Gutman 2019-01-04 18:18:32 -08:00
parent ff0f54d541
commit 1174e03885

View File

@ -365,8 +365,9 @@ public class ComputerManagerService extends Service {
// Block while we try to fill the details // Block while we try to fill the details
try { try {
runPoll(fakeDetails, true, 0); // We cannot use runPoll() here because it will attempt to persist the state of the machine
if (fakeDetails.state == ComputerDetails.State.ONLINE) { // in the database, which would be bad because we don't have our pinned cert loaded yet.
if (pollComputer(fakeDetails)) {
// See if we have record of this PC to pull its pinned cert // See if we have record of this PC to pull its pinned cert
synchronized (pollingTuples) { synchronized (pollingTuples) {
for (PollingTuple tuple : pollingTuples) { for (PollingTuple tuple : pollingTuples) {
@ -377,10 +378,9 @@ public class ComputerManagerService extends Service {
} }
} }
if (fakeDetails.serverCert != null) { // Poll again, possibly with the pinned cert, to get accurate pairing information.
// Poll again with the pinned cert to get accurate pairing information // This will insert the host into the database too.
runPoll(fakeDetails, true, 0); runPoll(fakeDetails, true, 0);
}
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
return false; return false;