From 83c8412474712075133ad09e66ebab9c60cfebf2 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 14 Mar 2018 16:13:07 +0000 Subject: [PATCH] issue #140: permit mitogen.unix.connect() to accept preconstructed Broker. Part of an effort to make resource management a little more explicit. --- mitogen/unix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mitogen/unix.py b/mitogen/unix.py index f3d5f453..683a07f5 100644 --- a/mitogen/unix.py +++ b/mitogen/unix.py @@ -92,7 +92,7 @@ class Listener(mitogen.core.BasicStream): sock.close() -def connect(path): +def connect(path, broker=None): LOG.debug('unix.connect(path=%r)', path) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(path) @@ -104,7 +104,7 @@ def connect(path): LOG.debug('unix.connect(): local ID is %r, remote is %r', mitogen.context_id, remote_id) - router = mitogen.master.Router() + router = mitogen.master.Router(broker=broker) stream = mitogen.core.Stream(router, remote_id) stream.accept(sock.fileno(), sock.fileno()) stream.name = 'unix_listener.%d' % (pid,)