Commit 83c84124 authored by David Wilson's avatar David Wilson

issue #140: permit mitogen.unix.connect() to accept preconstructed Broker.

Part of an effort to make resource management a little more explicit.
parent 65df3689
......@@ -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,)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment