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/sessions_manager.hpp b/sessions_manager.hpp
index cf28238..251ca96 100644
--- a/sessions_manager.hpp
+++ b/sessions_manager.hpp
@@ -53,11 +53,11 @@
* @return session handle on success and nullptr on failure
*
*/
- std::weak_ptr<Session> startSession(SessionID remoteConsoleSessID,
- Privilege priv,
- cipher::rakp_auth::Algorithms authAlgo,
- cipher::integrity::Algorithms intAlgo,
- cipher::crypt::Algorithms cryptAlgo);
+ std::shared_ptr<Session>
+ startSession(SessionID remoteConsoleSessID, Privilege priv,
+ cipher::rakp_auth::Algorithms authAlgo,
+ cipher::integrity::Algorithms intAlgo,
+ cipher::crypt::Algorithms cryptAlgo);
/**
* @brief Stop IPMI Session
@@ -79,7 +79,7 @@
* @return session handle on success and nullptr on failure
*
*/
- std::weak_ptr<Session>
+ std::shared_ptr<Session>
getSession(SessionID sessionID,
RetrieveOption option = RetrieveOption::BMC_SESSION_ID);