daemon: Call the EMANE post-startup function when entering the session

runtime state.

This should help synchronization startup for distributed emulations.
This commit is contained in:
tgoff0 2015-02-05 00:15:48 +00:00
parent 978f9946f1
commit 5bb00646d7

View file

@ -77,6 +77,8 @@ class Session(object):
self._state = None
self._hooks = {}
self._state_hooks = {}
self.add_state_hook(coreapi.CORE_EVENT_RUNTIME_STATE,
self.runtime_state_hook)
self.setstate(state=coreapi.CORE_EVENT_DEFINITION_STATE,
info=False, sendevent=False)
# dict of configuration items from /etc/core/core.conf config file
@ -344,6 +346,10 @@ class Session(object):
except KeyError:
pass
def runtime_state_hook(self, state):
if state == coreapi.CORE_EVENT_RUNTIME_STATE:
self.emane.poststartup()
def getenviron(self, state=True):
''' Get an environment suitable for a subprocess.Popen call.
This is the current process environment with some session-specific
@ -614,7 +620,6 @@ class Session(object):
# allow time for processes to start
time.sleep(0.125)
self.validatenodes()
self.emane.poststartup()
# assume either all nodes have booted already, or there are some
# nodes on slave servers that will be booted and those servers will
# send a node status response message