From 41ae6623c63a7e30af2f9109d5d31e77d16e0d31 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 25 Mar 2018 11:41:17 +0545 Subject: [PATCH] issue #155: parent: generic name generation Let us override a class attribute to specify prefix from fork.py, rather than reimplement the same logic. --- mitogen/parent.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mitogen/parent.py b/mitogen/parent.py index b8deb90b..42517438 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -440,11 +440,12 @@ class Stream(mitogen.core.Stream): return zlib.compress(minimize_source(source), 9) create_child = staticmethod(create_child) + name_prefix = 'local' def connect(self): LOG.debug('%r.connect()', self) self.pid, fd = self.create_child(*self.get_boot_command()) - self.name = 'local.%s' % (self.pid,) + self.name = '%s.%s' % (self.name_prefix, self.pid) self.receive_side = mitogen.core.Side(self, fd) self.transmit_side = mitogen.core.Side(self, os.dup(fd)) LOG.debug('%r.connect(): child process stdin/stdout=%r', @@ -572,9 +573,9 @@ class RouteMonitor(object): """ Respond to disconnection of a local stream by """ + LOG.debug('%r is gone; propagating DEL_ROUTE for %r', + stream, stream.routes) for target_id in stream.routes: - LOG.debug('%r is gone; propagating DEL_ROUTE for ID %d', - stream, target_id) self.router.del_route(target_id) self.propagate(mitogen.core.DEL_ROUTE, target_id)