diff options
author | Ed Tanous <edtanous@google.com> | 2022-02-22 08:33:06 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-03-23 00:09:03 +0300 |
commit | 863c1c2e78a8cce2e6b5cf0e80b8cf75fbc801b3 (patch) | |
tree | 918e715fe718633d772802ba52b000c7f1f97b66 /include/dbus_utility.hpp | |
parent | 2da6b8c94f7ef7d99d27de1815fd3568b350aaaf (diff) | |
download | bmcweb-863c1c2e78a8cce2e6b5cf0e80b8cf75fbc801b3.tar.xz |
nbd proxy and websocket cleanups
As-written, the nbd (and all websocket daemons) suffer from a problem
where there is no way to apply socket backpressure, so in certain
conditions, it's trivial to run the BMC out of memory on a given
message. This is a problem.
This commit implements the idea of an incremental callback handler, that
accepts a callback function to be run when the processing of the message
is complete. This allows applying backpressure on the socket, which in
turn, should provide pressure back to the client, and prevent buffering
crashes on slow connections, or connections with high latency.
Tested: NBD proxy not upstream, no way to test. No changes made to
normal websocket flow.
Signed-off-by: Michal Orzel <michalx.orzel@intel.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I3f116cc91eeadc949579deacbeb2d9f5e0f4fa53
Diffstat (limited to 'include/dbus_utility.hpp')
-rw-r--r-- | include/dbus_utility.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp index 854c2c1709..73952a2d57 100644 --- a/include/dbus_utility.hpp +++ b/include/dbus_utility.hpp @@ -16,6 +16,7 @@ #pragma once #include "dbus_singleton.hpp" +#include "logging.hpp" #include <boost/system/error_code.hpp> // IWYU pragma: keep #include <sdbusplus/asio/property.hpp> @@ -104,6 +105,14 @@ inline void escapePathForDbus(std::string& path) std::regex_replace(path.begin(), path.begin(), path.end(), reg, "_"); } +inline void logError(const boost::system::error_code& ec) +{ + if (ec) + { + BMCWEB_LOG_ERROR << "DBus error: " << ec << ", cannot call method"; + } +} + // gets the string N strings deep into a path // i.e. /0th/1st/2nd/3rd inline bool getNthStringFromPath(const std::string& path, int index, |