[stream-refactor] replace cutpaste with Stream.accept() in mitogen.unix

pull/607/head
David Wilson 5 years ago
parent 1843f183a3
commit f45d8eae66

@ -148,9 +148,7 @@ class Listener(mitogen.core.Protocol):
stream.name = u'unix_client.%d' % (pid,) stream.name = u'unix_client.%d' % (pid,)
stream.protocol.auth_id = mitogen.context_id stream.protocol.auth_id = mitogen.context_id
stream.protocol.is_privileged = True stream.protocol.is_privileged = True
side = mitogen.core.Side(stream, sock) stream.accept(sock, sock)
stream.receive_side = side
stream.transmit_side = side
LOG.debug('%r: accepted %r', self, stream) LOG.debug('%r: accepted %r', self, stream)
self._router.register(context, stream) self._router.register(context, stream)
@ -167,9 +165,7 @@ def _connect(path, broker, sock):
router = mitogen.master.Router(broker=broker) router = mitogen.master.Router(broker=broker)
stream = mitogen.core.MitogenProtocol.build_stream(router, remote_id) stream = mitogen.core.MitogenProtocol.build_stream(router, remote_id)
side = mitogen.core.Side(stream, sock) stream.accept(sock, sock)
stream.transmit_side = side
stream.receive_side = side
stream.name = u'unix_listener.%d' % (pid,) stream.name = u'unix_listener.%d' % (pid,)
mitogen.core.listen(stream, 'disconnect', _cleanup) mitogen.core.listen(stream, 'disconnect', _cleanup)

Loading…
Cancel
Save