Fix short window where newly added PC could be incorrectly marked as unpaired

This commit is contained in:
Cameron Gutman 2018-12-23 21:20:57 -08:00
parent 486b4b4c4c
commit 7e679ff4c6

View File

@ -366,6 +366,22 @@ public class ComputerManagerService extends Service {
// Block while we try to fill the details
try {
runPoll(fakeDetails, true, 0);
if (fakeDetails.state == ComputerDetails.State.ONLINE) {
// See if we have record of this PC to pull its pinned cert
synchronized (pollingTuples) {
for (PollingTuple tuple : pollingTuples) {
if (tuple.computer.uuid.equals(fakeDetails.uuid)) {
fakeDetails.serverCert = tuple.computer.serverCert;
break;
}
}
}
if (fakeDetails.serverCert != null) {
// Poll again with the pinned cert to get accurate pairing information
runPoll(fakeDetails, true, 0);
}
}
} catch (InterruptedException e) {
return false;
}