core: fix Dispatcher race introduced in 3a7815e5ca6255272334415916b6289378173859

It must be constructed before are messages pumped.
pull/372/head
David Wilson 6 years ago
parent 1247d1fce6
commit 37223adacd

@ -2214,6 +2214,7 @@ class ExternalContext(object):
if self.config.get('setup_stdio', True): if self.config.get('setup_stdio', True):
self._setup_stdio() self._setup_stdio()
self.dispatcher = Dispatcher(self)
self.router.register(self.parent, self.stream) self.router.register(self.parent, self.stream)
self.log_handler.uncork() self.log_handler.uncork()
@ -2222,7 +2223,6 @@ class ExternalContext(object):
self.parent, mitogen.context_id, os.getpid()) self.parent, mitogen.context_id, os.getpid())
_v and LOG.debug('Recovered sys.executable: %r', sys.executable) _v and LOG.debug('Recovered sys.executable: %r', sys.executable)
self.dispatcher = Dispatcher(self)
self.dispatcher.run() self.dispatcher.run()
_v and LOG.debug('ExternalContext.main() normal exit') _v and LOG.debug('ExternalContext.main() normal exit')
except KeyboardInterrupt: except KeyboardInterrupt:

Loading…
Cancel
Save