parent: tidy up create_socketpair()

pull/607/head
David Wilson 5 years ago
parent c0513425ca
commit 2ccdeeeb87

@ -260,13 +260,13 @@ def create_socketpair(size=None):
``stdout``. As they are sockets their buffers are tunable, allowing large ``stdout``. As they are sockets their buffers are tunable, allowing large
buffers to improve file transfer throughput and reduce IO loop iterations. buffers to improve file transfer throughput and reduce IO loop iterations.
""" """
if size is None:
size = mitogen.core.CHUNK_SIZE
parentfp, childfp = socket.socketpair() parentfp, childfp = socket.socketpair()
parentfp.setsockopt(socket.SOL_SOCKET, for fp in parentfp, childfp:
socket.SO_SNDBUF, fp.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, size)
size or mitogen.core.CHUNK_SIZE)
childfp.setsockopt(socket.SOL_SOCKET,
socket.SO_RCVBUF,
size or mitogen.core.CHUNK_SIZE)
return parentfp, childfp return parentfp, childfp

Loading…
Cancel
Save