Skip to content

Commit c38fdfc

Browse files
committed
Make WaitForAvailability non-const.
This allows for protecting the bodies of WaitForAvailability with mutexes without having to mark them as mutable, and adding extra variables to track the state of availability so calls can be idempotent.
1 parent 79c63ed commit c38fdfc

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

base/cvd/cuttlefish/host/commands/run_cvd/launch/cvdalloc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Cvdalloc : public vm_manager::VmmDependencyCommand {
7575
}
7676

7777
// StatusCheckCommandSource
78-
Result<void> WaitForAvailability() const override {
78+
Result<void> WaitForAvailability() override {
7979
LOG(INFO) << "cvdalloc (run_cvd): waiting to finish allocation.";
8080
CF_EXPECT(cvdalloc::Wait(socket_, kCvdAllocateTimeout),
8181
"cvdalloc (run_cvd): Wait failed");

base/cvd/cuttlefish/host/commands/run_cvd/launch/mcu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class Mcu : public vm_manager::VmmDependencyCommand {
9393
}
9494

9595
// StatusCheckCommandSource
96-
Result<void> WaitForAvailability() const override {
96+
Result<void> WaitForAvailability() override {
9797
if (!Enabled()) {
9898
return {};
9999
}

base/cvd/cuttlefish/host/commands/run_cvd/launch/ti50_emulator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Ti50Emulator : public vm_manager::VmmDependencyCommand {
8080
bool Enabled() const override { return !instance_.ti50_emulator().empty(); }
8181

8282
// StatusCheckCommandSource
83-
Result<void> WaitForAvailability() const override {
83+
Result<void> WaitForAvailability() override {
8484
if (!Enabled()) {
8585
return {};
8686
}

base/cvd/cuttlefish/host/commands/run_cvd/launch/vhost_device_vsock.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class VhostDeviceVsock : public vm_manager::VmmDependencyCommand {
5656
std::string Name() const override;
5757
bool Enabled() const override;
5858

59-
Result<void> WaitForAvailability() const override;
59+
Result<void> WaitForAvailability() override;
6060

6161
private:
6262
std::unordered_set<SetupFeature*> Dependencies() const override { return {}; }
@@ -113,7 +113,7 @@ std::string VhostDeviceVsock::Name() const { return "VhostDeviceVsock"; }
113113

114114
bool VhostDeviceVsock::Enabled() const { return instance_.vhost_user_vsock(); }
115115

116-
Result<void> VhostDeviceVsock::WaitForAvailability() const {
116+
Result<void> VhostDeviceVsock::WaitForAvailability() {
117117
if (Enabled()) {
118118
CF_EXPECT(WaitForUnixSocket(
119119
fmt::format("{}/vsock_{}_{}/vm.vsock", TempDir(),

base/cvd/cuttlefish/host/commands/run_cvd/launch/wmediumd_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool WmediumdServer::Enabled() const {
103103
return instance_.start_wmediumd_instance();
104104
}
105105

106-
Result<void> WmediumdServer::WaitForAvailability() const {
106+
Result<void> WmediumdServer::WaitForAvailability() {
107107
if (Enabled()) {
108108
if (!environment_.wmediumd_api_server_socket().empty()) {
109109
CF_EXPECT(

base/cvd/cuttlefish/host/commands/run_cvd/launch/wmediumd_server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class WmediumdServer : public vm_manager::VmmDependencyCommand {
4444
std::string Name() const override;
4545
bool Enabled() const override;
4646

47-
Result<void> WaitForAvailability() const override;
47+
Result<void> WaitForAvailability() override;
4848

4949
private:
5050
std::unordered_set<SetupFeature*> Dependencies() const override;

base/cvd/cuttlefish/host/libs/feature/command_source.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CommandSource : public virtual SetupFeature {
4343

4444
class StatusCheckCommandSource : public virtual CommandSource {
4545
public:
46-
virtual Result<void> WaitForAvailability() const = 0;
46+
virtual Result<void> WaitForAvailability() = 0;
4747
};
4848

4949
} // namespace cuttlefish

0 commit comments

Comments
 (0)