replace tuple-based singleton with individual singletons
The tuple-based singletons did not actually enforce singleton behavior
and the requirement of the accessor mechanism to include all of the
member types at once was starting to cause a header prerequisite
tangle. This removes the cross-dependencies and enforces actual
singletons by making a single way to access the class.
Tested: Run ipmitool to show that behavior has not changed
Change-Id: Ie966e1142363d279365b1095066380c8383e9f9b
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/command/rakp34.cpp b/command/rakp34.cpp
index b106b6f..a8ad86a 100644
--- a/command/rakp34.cpp
+++ b/command/rakp34.cpp
@@ -3,8 +3,8 @@
#include "comm_module.hpp"
#include "endian.hpp"
#include "guid.hpp"
-#include "main.hpp"
#include "rmcp.hpp"
+#include "sessions_manager.hpp"
#include <algorithm>
#include <cstring>
@@ -17,8 +17,7 @@
void applyIntegrityAlgo(const uint32_t bmcSessionID)
{
- auto session =
- std::get<session::Manager&>(singletonPool).getSession(bmcSessionID);
+ auto session = session::Manager::get().getSession(bmcSessionID);
auto authAlgo = session->getAuthAlgo();
@@ -45,8 +44,7 @@
void applyCryptAlgo(const uint32_t bmcSessionID)
{
- auto session =
- std::get<session::Manager&>(singletonPool).getSession(bmcSessionID);
+ auto session = session::Manager::get().getSession(bmcSessionID);
auto authAlgo = session->getAuthAlgo();
@@ -97,8 +95,7 @@
try
{
session =
- std::get<session::Manager&>(singletonPool)
- .getSession(endian::from_ipmi(request->managedSystemSessionID));
+ session::Manager::get().getSession(request->managedSystemSessionID);
}
catch (std::exception& e)
{
@@ -174,8 +171,7 @@
response->remoteConsoleSessionID = rcSessionID;
// close the session
- std::get<session::Manager&>(singletonPool)
- .stopSession(session->getBMCSessionID());
+ session::Manager::get().stopSession(session->getBMCSessionID());
return outPayload;
}