ensured the shutdown event doesn't get sent until all node delete replies have been sent
This commit is contained in:
parent
3f6040a0f3
commit
6e610f4309
1 changed files with 14 additions and 10 deletions
|
@ -306,6 +306,7 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
|
||||||
self.msgq = []
|
self.msgq = []
|
||||||
self.msgcv = threading.Condition()
|
self.msgcv = threading.Condition()
|
||||||
self.nodestatusreq = {}
|
self.nodestatusreq = {}
|
||||||
|
self._shutdownlock = threading.Lock()
|
||||||
numthreads = int(server.cfg['numthreads'])
|
numthreads = int(server.cfg['numthreads'])
|
||||||
if numthreads < 1:
|
if numthreads < 1:
|
||||||
raise ValueError, \
|
raise ValueError, \
|
||||||
|
@ -666,16 +667,19 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
|
||||||
n = self.session.obj(nodenum)
|
n = self.session.obj(nodenum)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
self.session.delobj(nodenum)
|
|
||||||
|
with self._shutdownlock:
|
||||||
if msg.flags & coreapi.CORE_API_STR_FLAG:
|
self.session.delobj(nodenum)
|
||||||
tlvdata = ""
|
|
||||||
tlvdata += coreapi.CoreNodeTlv.pack(coreapi.CORE_TLV_NODE_NUMBER,
|
if msg.flags & coreapi.CORE_API_STR_FLAG:
|
||||||
nodenum)
|
tlvdata = ""
|
||||||
flags = coreapi.CORE_API_DEL_FLAG | coreapi.CORE_API_LOC_FLAG
|
tlvdata += coreapi.CoreNodeTlv.pack(coreapi.CORE_TLV_NODE_NUMBER,
|
||||||
replies.append(coreapi.CoreNodeMessage.pack(flags, tlvdata))
|
nodenum)
|
||||||
for reply in self.session.checkshutdown():
|
flags = coreapi.CORE_API_DEL_FLAG | coreapi.CORE_API_LOC_FLAG
|
||||||
replies.append(reply)
|
replies.append(coreapi.CoreNodeMessage.pack(flags, tlvdata))
|
||||||
|
|
||||||
|
for reply in self.session.checkshutdown():
|
||||||
|
replies.append(reply)
|
||||||
# Node modify message (no add/del flag)
|
# Node modify message (no add/del flag)
|
||||||
else:
|
else:
|
||||||
n = None
|
n = None
|
||||||
|
|
Loading…
Add table
Reference in a new issue