Fix Online -> Offline computer transition
This commit is contained in:
parent
13490af90c
commit
186579266c
1 changed files with 6 additions and 11 deletions
|
|
@ -148,31 +148,26 @@ private:
|
||||||
int pollsSinceLastAppListFetch = POLLS_PER_APPLIST_FETCH;
|
int pollsSinceLastAppListFetch = POLLS_PER_APPLIST_FETCH;
|
||||||
while (!isInterruptionRequested()) {
|
while (!isInterruptionRequested()) {
|
||||||
bool stateChanged = false;
|
bool stateChanged = false;
|
||||||
for (int i = 0; i < TRIES_BEFORE_OFFLINING; i++) {
|
bool online = false;
|
||||||
|
for (int i = 0; i < TRIES_BEFORE_OFFLINING && !online; i++) {
|
||||||
for (auto& address : m_Computer->uniqueAddresses()) {
|
for (auto& address : m_Computer->uniqueAddresses()) {
|
||||||
if (isInterruptionRequested()) {
|
if (isInterruptionRequested()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tryPollComputer(address, stateChanged)) {
|
if (tryPollComputer(address, stateChanged)) {
|
||||||
|
online = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to continue retrying if we're online
|
|
||||||
if (m_Computer->state == NvComputer::CS_ONLINE) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we failed after all retry attempts
|
// Check if we failed after all retry attempts
|
||||||
// Note: we don't need to acquire the read lock here,
|
// Note: we don't need to acquire the read lock here,
|
||||||
// because we're on the writing thread.
|
// because we're on the writing thread.
|
||||||
if (m_Computer->state != NvComputer::CS_ONLINE) {
|
if (!online && m_Computer->state != NvComputer::CS_OFFLINE) {
|
||||||
if (m_Computer->state != NvComputer::CS_OFFLINE) {
|
m_Computer->state = NvComputer::CS_OFFLINE;
|
||||||
m_Computer->state = NvComputer::CS_OFFLINE;
|
stateChanged = true;
|
||||||
stateChanged = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the applist if it's empty or it's been long enough that we need to refresh
|
// Grab the applist if it's empty or it's been long enough that we need to refresh
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue