appear to have fixed the gui shutdown issue with messages being sent out of order, causing a node to remain with a red box
This commit is contained in:
parent
14a5d11c4e
commit
e2a932698c
2 changed files with 9 additions and 4 deletions
|
@ -134,6 +134,7 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
|
|||
# remove client from session broker and shutdown if there are no clients
|
||||
self.session.broker.session_clients.remove(self)
|
||||
if not self.session.broker.session_clients:
|
||||
logger.info("no session clients left, initiating shutdown")
|
||||
self.session.shutdown()
|
||||
|
||||
return SocketServer.BaseRequestHandler.finish(self)
|
||||
|
@ -672,7 +673,10 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
|
|||
flags = MessageFlags.DELETE.value | MessageFlags.LOCAL.value
|
||||
replies.append(coreapi.CoreNodeMessage.pack(flags, tlvdata))
|
||||
|
||||
self.session.check_shutdown()
|
||||
if self.session.check_shutdown():
|
||||
tlvdata = ""
|
||||
tlvdata += coreapi.CoreEventTlv.pack(EventTlvs.TYPE.value, self.session.state)
|
||||
replies.append(coreapi.CoreEventMessage.pack(0, tlvdata))
|
||||
# Node modify message (no add/del flag)
|
||||
else:
|
||||
try:
|
||||
|
|
|
@ -906,14 +906,15 @@ class Session(object):
|
|||
and links remain.
|
||||
"""
|
||||
node_count = self.get_node_count()
|
||||
|
||||
logger.info("checking shutdown for session %d: %d nodes remaining", self.session_id, node_count)
|
||||
|
||||
# TODO: do we really want a check that finds 0 nodes to initiate a shutdown state?
|
||||
shutdown = False
|
||||
if node_count == 0:
|
||||
self.set_state(state=EventTypes.SHUTDOWN_STATE.value, send_event=True)
|
||||
shutdown = True
|
||||
self.set_state(state=EventTypes.SHUTDOWN_STATE.value)
|
||||
# TODO: this seems redundant as it occurs during shutdown as well
|
||||
self.sdt.shutdown()
|
||||
return shutdown
|
||||
|
||||
def short_session_id(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue