Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Refactor CheckPoolState to use a cleaner switch.
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Vacek <[email protected]>
  • Loading branch information
pattivacek committed Dec 17, 2018
1 parent 8638659 commit 5694746
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/sota_tools/deploy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
#include "utilities/utils.h"

bool CheckPoolState(const OSTreeObject::ptr &root_object, const RequestPool &request_pool) {
if (request_pool.run_mode() == RunMode::kWalkTree || request_pool.run_mode() == RunMode::kPushTree) {
return !request_pool.is_idle() && !request_pool.is_stopped();
} else {
return root_object->is_on_server() != PresenceOnServer::kObjectPresent && !request_pool.is_stopped();
switch (request_pool.run_mode()) {
case RunMode::kWalkTree:
return !request_pool.is_stopped() && !request_pool.is_idle();
case RunMode::kPushTree:
return root_object->is_on_server() != PresenceOnServer::kObjectPresent && !request_pool.is_stopped() &&
!request_pool.is_idle();
default:
return root_object->is_on_server() != PresenceOnServer::kObjectPresent && !request_pool.is_stopped();
}
}

Expand Down

0 comments on commit 5694746

Please sign in to comment.