diff options
author | Iwona Klimaszewska <iwona.klimaszewska@intel.com> | 2019-07-12 19:26:38 +0300 |
---|---|---|
committer | Iwona Klimaszewska <iwona.klimaszewska@intel.com> | 2019-11-21 16:35:56 +0300 |
commit | c0a1c8a0ecc55aef54e6f44ea89a4dd232e265a2 (patch) | |
tree | 601c03c2976c4ffaab6ee62c4c8af38743d415e4 /include/async_resp.hpp | |
parent | e6604b116afef4cd603956941e299e7bcda4351a (diff) | |
download | bmcweb-c0a1c8a0ecc55aef54e6f44ea89a4dd232e265a2.tar.xz |
Implement nbd-proxy as a part of bmcweb
Nbd-proxy is responsible for exposing websocket endpoint in bmcweb.
It matches WS endpoints with unix socket paths using configuration
exposed on D-Bus by Virtual-Media.
Virtual-Media is then notified about unix socket availability through
mount/unmount D-Bus methods.
Currently, this feature is disabled by default.
Tested: Integrated with initial version of Virtual-Media.
Change-Id: I9c572e9841b16785727e5676fea1bb63b0311c63
Signed-off-by: Iwona Klimaszewska <iwona.klimaszewska@intel.com>
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Diffstat (limited to 'include/async_resp.hpp')
-rw-r--r-- | include/async_resp.hpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/async_resp.hpp b/include/async_resp.hpp index af4edebc53..78994cf77e 100644 --- a/include/async_resp.hpp +++ b/include/async_resp.hpp @@ -1,5 +1,7 @@ #pragma once +#include <functional> + namespace bmcweb { @@ -7,6 +9,7 @@ namespace bmcweb * AsyncResp * Gathers data needed for response processing after async calls are done */ + class AsyncResp { public: @@ -14,12 +17,23 @@ class AsyncResp { } + AsyncResp(crow::Response& response, std::function<void()>&& function) : + res(response), func(std::move(function)) + { + } + ~AsyncResp() { + if (func && res.result() == boost::beast::http::status::ok) + { + func(); + } + res.end(); } crow::Response& res; + std::function<void()> func = 0; }; -} // namespace bmcweb
\ No newline at end of file +} // namespace bmcweb |