Commit af1e2004 authored by Jim Fulton's avatar Jim Fulton

Cleaner fix.

I'd missed that you could get a transport's socket using get_extra_info.
parent 3d886d42
...@@ -46,13 +46,12 @@ class Protocol(asyncio.Protocol): ...@@ -46,13 +46,12 @@ class Protocol(asyncio.Protocol):
def connection_made(self, transport): def connection_made(self, transport):
logger.info("Connected %s", self) logger.info("Connected %s", self)
if (sys.version_info < (3, 6) and
hasattr(transport, '_sock') and if sys.version_info < (3, 6):
transport._sock.family in INET_FAMILIES sock = transport.get_extra_info('socket')
): if sock is not None and sock.family in INET_FAMILIES:
# See https://bugs.python.org/issue27456 :( # See https://bugs.python.org/issue27456 :(
transport._sock.setsockopt( sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True)
socket.IPPROTO_TCP, socket.TCP_NODELAY, True)
self.transport = transport self.transport = transport
paused = self.paused paused = self.paused
......
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