From beb16d0db663244ee26987796452a65ece3f9f7e Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 15 Feb 2018 00:45:09 +0545 Subject: [PATCH] master: helper functions to force disconnect everything --- mitogen/master.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mitogen/master.py b/mitogen/master.py index 929e9d3f..9d1f33b2 100644 --- a/mitogen/master.py +++ b/mitogen/master.py @@ -615,6 +615,13 @@ class Router(mitogen.parent.Router): child = parent parent = parent.via + def disconnect_stream(self, stream): + self.broker.defer(stream.on_disconnect, self.broker) + + def disconnect_all(self): + for stream in self._stream_by_id.values(): + self.disconnect_stream(stream) + class IdAllocator(object): def __init__(self, router):