Remove getIoContext from Request object
At one point it was thought that we could pass the io_context object
through the request object, and have the potential to run multiple
io_context instances (one per connection).
Given the safety refactoring we had to do in
9838eb20341568971b9543c2187372d20daf64aa that idea is on ice for the
moment, and would need a major rethink of code to be viable. For the
moment, and in prep for
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/75668
make sure all calls are pulling from the same io object.
Tested: Unit tests pass. Redfish service validator passes.
Change-Id: I877752005c4ce94efbc13ce815f3cd0d99cc3d51
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index 424cb80..95cb982 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -7,6 +7,7 @@
#include "app.hpp"
#include "dbus_singleton.hpp"
#include "dbus_utility.hpp"
+#include "io_context_singleton.hpp"
#include "logging.hpp"
#include "websocket.hpp"
@@ -205,8 +206,8 @@
const std::string& endpointIdIn, const std::string& pathIn) :
socketId(socketIdIn), endpointId(endpointIdIn), path(pathIn),
- peerSocket(connIn.getIoContext()),
- acceptor(connIn.getIoContext(), stream_protocol::endpoint(socketId)),
+ peerSocket(getIoContext()),
+ acceptor(getIoContext(), stream_protocol::endpoint(socketId)),
connection(connIn)
{}
@@ -585,7 +586,7 @@
// media is the last digit of the endpoint /vm/0/0. A future
// enhancement can include supporting different endpoint values.
const char* media = "0";
- handler = std::make_shared<Handler>(media, conn.getIoContext());
+ handler = std::make_shared<Handler>(media, getIoContext());
handler->connect();
})
.onclose([](crow::websocket::Connection& conn,