summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/selector_events.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2018-12-03 19:08:13 (GMT)
committerGitHub <noreply@github.com>2018-12-03 19:08:13 (GMT)
commit3bc0ebab17bf5a2c29d2214743c82034f82e6573 (patch)
tree4dd0d06eb85963408b9d811b19d07116a51a70c7 /Lib/asyncio/selector_events.py
parent3bb150d8148e3cc08418077a58f43e064b9fde61 (diff)
downloadcpython-3bc0ebab17bf5a2c29d2214743c82034f82e6573.zip
cpython-3bc0ebab17bf5a2c29d2214743c82034f82e6573.tar.gz
cpython-3bc0ebab17bf5a2c29d2214743c82034f82e6573.tar.bz2
bpo-35380: Enable TCP_NODELAY for proactor event loop (#10867)
Diffstat (limited to 'Lib/asyncio/selector_events.py')
-rw-r--r--Lib/asyncio/selector_events.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index ad09300..112c4b1 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -39,17 +39,6 @@ def _test_selector_event(selector, fd, event):
return bool(key.events & event)
-if hasattr(socket, 'TCP_NODELAY'):
- def _set_nodelay(sock):
- if (sock.family in {socket.AF_INET, socket.AF_INET6} and
- sock.type == socket.SOCK_STREAM and
- sock.proto == socket.IPPROTO_TCP):
- sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
-else:
- def _set_nodelay(sock):
- pass
-
-
class BaseSelectorEventLoop(base_events.BaseEventLoop):
"""Selector event loop.
@@ -742,7 +731,7 @@ class _SelectorSocketTransport(_SelectorTransport):
# Disable the Nagle algorithm -- small writes will be
# sent without waiting for the TCP ACK. This generally
# decreases the latency (in some cases significantly.)
- _set_nodelay(self._sock)
+ base_events._set_nodelay(self._sock)
self._loop.call_soon(self._protocol.connection_made, self)
# only start reading when connection_made() has been called