From 31757e41e373d211202e7eaf0dd72cbd51ea63ea Mon Sep 17 00:00:00 2001 From: Gerorge Liao Date: Tue, 2 Jul 2024 12:27:49 +0200 Subject: [PATCH] [daemon] changed adapter from std::bind to lambda. --- src/daemon/daemon.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index ceaadd83b2..a38552498e 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -2132,15 +2132,13 @@ try // clang-format on std::function operation; if (request->cancel_shutdown()) - operation = std::bind(&Daemon::cancel_vm_shutdown, this, std::placeholders::_1); + operation = [this](const VirtualMachine& vm) { return this->cancel_vm_shutdown(vm); }; else if (request->force_stop()) - { - auto adapted_switch_off_vm = [this](auto&& arg) -> grpc::Status { return this->switch_off_vm(arg); }; - operation = adapted_switch_off_vm; - } + operation = [this](VirtualMachine& vm) { return this->switch_off_vm(vm); }; else - operation = std::bind(&Daemon::shutdown_vm, this, std::placeholders::_1, - std::chrono::minutes(request->time_minutes())); + operation = [this, delay_minutes = std::chrono::minutes(request->time_minutes())](VirtualMachine& vm) { + return this->shutdown_vm(vm, delay_minutes); + }; status = cmd_vms(instance_selection.operative_selection, operation); }