mirror of
https://opendev.org/x/pyghmi
synced 2025-01-27 19:37:44 +00:00
Handle disconnect notification without session
If session no longer exists, do not try to manipulate it's keepalives. Remove instances of calling the function where it would be redundant. Change-Id: I2011f8012175ef12ce83eb34fbf4de9650fb157e
This commit is contained in:
parent
c35781d4cf
commit
77d7d373c3
@ -146,7 +146,6 @@ class Console(object):
|
||||
def _got_payload_instance_info(self, response):
|
||||
if 'error' in response:
|
||||
self.activated = False
|
||||
self.ipmi_session.unregister_keepalive(self.keepaliveid)
|
||||
self._print_error(response['error'])
|
||||
return
|
||||
currowner = struct.unpack(
|
||||
@ -154,7 +153,6 @@ class Console(object):
|
||||
if currowner[0] != self.ipmi_session.sessionid:
|
||||
# the session is deactivated or active for something else
|
||||
self.activated = False
|
||||
self.ipmi_session.unregister_keepalive(self.keepaliveid)
|
||||
self._print_error('SOL deactivated')
|
||||
return
|
||||
# ok, still here, that means session is alive, but another
|
||||
@ -184,7 +182,8 @@ class Console(object):
|
||||
def close(self):
|
||||
"""Shut down an SOL session,
|
||||
"""
|
||||
self.ipmi_session.unregister_keepalive(self.keepaliveid)
|
||||
if self.ipmi_session:
|
||||
self.ipmi_session.unregister_keepalive(self.keepaliveid)
|
||||
if self.activated:
|
||||
try:
|
||||
self.ipmi_session.raw_command(netfn=6, command=0x49,
|
||||
|
Loading…
x
Reference in New Issue
Block a user