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/message_handler.cpp b/message_handler.cpp
index 62855a9..c5d5d4e 100644
--- a/message_handler.cpp
+++ b/message_handler.cpp
@@ -35,9 +35,8 @@
     std::unique_ptr<Message> message;
     std::tie(message, sessionHeader) = parser::unflatten(packet);
 
-    auto session = (std::get<session::Manager&>(singletonPool)
-                        .getSession(message->bmcSessionID))
-                       .lock();
+    auto session = std::get<session::Manager&>(singletonPool)
+                       .getSession(message->bmcSessionID);
 
     sessionID = message->bmcSessionID;
     message->rcSessionID = session->getRCSessionID();
@@ -166,8 +165,7 @@
 void Handler::send(Message& outMessage)
 {
     auto session =
-        (std::get<session::Manager&>(singletonPool).getSession(sessionID))
-            .lock();
+        std::get<session::Manager&>(singletonPool).getSession(sessionID);
 
     // Flatten the packet
     auto packet = parser::flatten(outMessage, sessionHeader, *session);
@@ -183,8 +181,7 @@
 void Handler::setChannelInSession() const
 {
     auto session =
-        (std::get<session::Manager&>(singletonPool).getSession(sessionID))
-            .lock();
+        std::get<session::Manager&>(singletonPool).getSession(sessionID);
 
     session->channelPtr = channel;
 }
@@ -194,8 +191,7 @@
     Message outMessage;
 
     auto session =
-        (std::get<session::Manager&>(singletonPool).getSession(sessionID))
-            .lock();
+        std::get<session::Manager&>(singletonPool).getSession(sessionID);
 
     outMessage.payloadType = PayloadType::SOL;
     outMessage.payload = input;
@@ -213,8 +209,7 @@
     Message outMessage;
 
     auto session =
-        (std::get<session::Manager&>(singletonPool).getSession(sessionID))
-            .lock();
+        std::get<session::Manager&>(singletonPool).getSession(sessionID);
 
     outMessage.payloadType = PayloadType::IPMI;
     outMessage.isPacketEncrypted = session->isCryptAlgoEnabled();