daemon: Improve event handling some.

This commit is contained in:
tgoff0 2015-03-24 18:06:49 +00:00
parent 61d0f34982
commit abaed4924b

View file

@ -1127,14 +1127,22 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
coreapi.CORE_EVENT_RESTART, \
coreapi.CORE_EVENT_PAUSE, \
coreapi.CORE_EVENT_RECONFIGURE):
handled = False
name = msg.gettlv(coreapi.CORE_TLV_EVENT_NAME)
# TODO: register system for event message handlers, like confobjs
if name[:8] == "service:":
if name:
# TODO: register system for event message handlers,
# like confobjs
if name.startswith("service:"):
self.session.services.handleevent(msg)
elif name[:9] == "mobility:":
handled = True
elif name.startswith("mobility:"):
self.session.mobility.handleevent(msg)
handled = True
else:
self.warn("Unhandled event message: event type %d" % eventtype)
pass
if not handled:
self.warn("Unhandled event message: event type %s (%s)" % \
(eventtype, coreapi.state_name(eventtype)))
elif eventtype == coreapi.CORE_EVENT_FILE_OPEN:
self.session.delobjs()
self.session.delhooks()