netipmid: use std::shared_ptr instead of weak_ptr/lock
All of the instances of getSession and startSession were assigning the
result to a local shared_ptr via lock on the weak_ptr. It doesn't make
sense to demote the shared_ptr (from the sessionsMap) to a weak_ptr via
the return, only to promote to a shared_ptr again via lock.
Tested-by: running ipmitool -H a.b.c.d -P 0penBmc -I lanplus mc info
Sessions start and stop, same as before.
Change-Id: Ic10779285891d73ee51115f16ed0000b38d1c52a
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/command/rakp34.cpp b/command/rakp34.cpp
index 76236d5..84c90fc 100644
--- a/command/rakp34.cpp
+++ b/command/rakp34.cpp
@@ -16,8 +16,7 @@
void applyIntegrityAlgo(const uint32_t bmcSessionID)
{
auto session =
- (std::get<session::Manager&>(singletonPool).getSession(bmcSessionID))
- .lock();
+ std::get<session::Manager&>(singletonPool).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))
- .lock();
+ std::get<session::Manager&>(singletonPool).getSession(bmcSessionID);
auto authAlgo = session->getAuthAlgo();
@@ -96,10 +94,9 @@
std::shared_ptr<session::Session> session;
try
{
- session = (std::get<session::Manager&>(singletonPool)
- .getSession(
- endian::from_ipmi(request->managedSystemSessionID)))
- .lock();
+ session =
+ std::get<session::Manager&>(singletonPool)
+ .getSession(endian::from_ipmi(request->managedSystemSessionID));
}
catch (std::exception& e)
{