summaryrefslogtreecommitdiff
path: root/src/state/ready_state.hpp
diff options
context:
space:
mode:
authorPrzemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>2022-03-15 00:20:54 +0300
committerGitHub <noreply@github.com>2022-03-15 00:20:54 +0300
commited2aceab6ee059a40d939ea21364bc18ec80d94b (patch)
tree654bbae1b29b9dcdc6e4ed0036dc5d70ad0544a5 /src/state/ready_state.hpp
parent1fb7beae5e97aadf8471ae7b6e07f5c2e5f33c78 (diff)
downloadvirtual-media-ed2aceab6ee059a40d939ea21364bc18ec80d94b.tar.xz
Make mount/unmount dbus calls asynchronous
Change the default behavior of mount/umount dbus calls from blocking to unblocking ones. Once mount/unmount is triggered, appropriate action is running in the background moving handling of operation result to async event. At the end of processing dbus completion signal is sent to client with uint value of operation status (identical with errno code). Tested: Manual scheduling of mount and unmount operations with monitoring dbus communication of virtual-media service - matching api calls with completion signal. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Diffstat (limited to 'src/state/ready_state.hpp')
-rw-r--r--src/state/ready_state.hpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/state/ready_state.hpp b/src/state/ready_state.hpp
index bf1e160..e20e700 100644
--- a/src/state/ready_state.hpp
+++ b/src/state/ready_state.hpp
@@ -24,7 +24,10 @@ struct ReadyState : public BasicStateT<ReadyState>
};
ReadyState(interfaces::MountPointStateMachine& machine) :
- BasicStateT(machine){};
+ BasicStateT(machine)
+ {
+ machine.notify();
+ };
ReadyState(interfaces::MountPointStateMachine& machine, const std::errc& ec,
const std::string& message) :
@@ -33,6 +36,7 @@ struct ReadyState : public BasicStateT<ReadyState>
{
LogMsg(Logger::Error, machine.getName(),
" Errno = ", static_cast<int>(ec), " : ", message);
+ machine.notify(std::make_error_code(ec));
}
std::unique_ptr<BasicState> onEnter() override
@@ -47,6 +51,7 @@ struct ReadyState : public BasicStateT<ReadyState>
std::unique_ptr<BasicState> handleEvent(MountEvent event)
{
+ machine.notificationStart();
if (event.target)
{
machine.getTarget() = std::move(event.target);