From 9aa845669ce2bfe700e22ce6babf7d64e03c82a5 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 29 Jan 2019 04:41:02 +0000 Subject: [PATCH] issue #413: don't double-propagate DEL_ROUTE to parent. propagate_up() sends ADD_ROUTE and DEL_ROUTE propagate_down() sends only DEL_ROUTE, but didn't bother checking if up() had sent it already. Fixes: ERROR! [pid 41060] 17:55:30.739159 E mitogen.ctx.ssh.localhost: mitogen: RouteMonitor(): received DEL_ROUTE for 6081 from mitogen.fork.Stream(u'fork.41142'), expected mitogen.core.Stream('parent') --- mitogen/parent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mitogen/parent.py b/mitogen/parent.py index fcefd460..e23ffa3c 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -1780,7 +1780,10 @@ class RouteMonitor(object): ID of the connecting or disconnecting context. """ for stream in self.router.get_streams(): - if target_id in stream.egress_ids: + if target_id in stream.egress_ids and ( + (self.parent is None) or + (self.parent.context_id != stream.remote_id) + ): self._send_one(stream, mitogen.core.DEL_ROUTE, target_id, None) def notice_stream(self, stream):