diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py
index <HASH>..<HASH> 100644
--- a/pyghmi/ipmi/private/session.py
+++ b/pyghmi/ipmi/private/session.py
@@ -315,7 +315,8 @@ class Session(object):
             if sockaddr in cls.bmc_handlers:
                 self = cls.bmc_handlers[sockaddr]
                 if (self.bmc == bmc and self.userid == userid and
-                        self.password == password and self.kgo == kg):
+                        self.password == password and self.kgo == kg and
+                        self.logged):
                     trueself = self
                 else:
                     del cls.bmc_handlers[sockaddr]
Do not reuse a session that is not logged

If a session was not logged, it would still be considered a candidate for
new session objects.  Disqualify such sessions so that new session
objects after a 'logout' or similar will be fulfilled.

Change-Id: I7af<I>a8a<I>b7aedcadcec<I>d<I>e3b<I>f<I>d