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_RESTART, \
coreapi.CORE_EVENT_PAUSE, \ coreapi.CORE_EVENT_PAUSE, \
coreapi.CORE_EVENT_RECONFIGURE): coreapi.CORE_EVENT_RECONFIGURE):
handled = False
name = msg.gettlv(coreapi.CORE_TLV_EVENT_NAME) name = msg.gettlv(coreapi.CORE_TLV_EVENT_NAME)
# TODO: register system for event message handlers, like confobjs if name:
if name[:8] == "service:": # TODO: register system for event message handlers,
self.session.services.handleevent(msg) # like confobjs
elif name[:9] == "mobility:": if name.startswith("service:"):
self.session.mobility.handleevent(msg) self.session.services.handleevent(msg)
else: handled = True
self.warn("Unhandled event message: event type %d" % eventtype) elif name.startswith("mobility:"):
self.session.mobility.handleevent(msg)
handled = True
else:
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: elif eventtype == coreapi.CORE_EVENT_FILE_OPEN:
self.session.delobjs() self.session.delobjs()
self.session.delhooks() self.session.delhooks()