Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c030ee4
Add support for existing TCP_QUICKACK socket setting to Windows
nkinnan Aug 29, 2024
8d510a2
📜🤖 Added by blurb_it.
blurb-it[bot] Aug 29, 2024
635e385
bugfix in previous commit
nkinnan Aug 29, 2024
ac49caf
Merge branch 'main' of https://github.com/nkinnan/cpython into main
nkinnan Aug 29, 2024
183a18e
bugfix in previous commit
nkinnan Aug 29, 2024
e96d9db
remove test case since it works on windows but fails in the server en…
nkinnan Aug 29, 2024
8147664
Update Lib/test/test_socket.py
nkinnan Aug 29, 2024
02ffa52
modify news
nkinnan Aug 29, 2024
4f92750
Merge branch 'main' of https://github.com/nkinnan/cpython into main
nkinnan Aug 29, 2024
1ca08b7
remove last bit of unit test straggler code
nkinnan Aug 29, 2024
a0889a5
cleanup
nkinnan Aug 29, 2024
f2e8cca
whitespace
nkinnan Aug 29, 2024
a607fec
Update Modules/socketmodule.c
nkinnan Aug 30, 2024
016a2c6
Update Misc/NEWS.d/next/Windows/2024-08-29-16-13-45.gh-issue-123476.m…
nkinnan Aug 30, 2024
d06cbe7
Merge branch 'main' into main
nkinnan Aug 30, 2024
ce8c1ab
additional documentation in socket.rst -- needs python release versio…
nkinnan Aug 30, 2024
5c887b6
Merge branch 'main' of https://github.com/nkinnan/cpython into main
nkinnan Aug 30, 2024
8185776
unit test that should work even if TCP_QUICKACK is already turned on …
nkinnan Aug 30, 2024
7616b21
lint
nkinnan Aug 30, 2024
4b49a2e
Update socket.rst
nkinnan Aug 30, 2024
94f9087
Update Modules/socketmodule.h
nkinnan Aug 31, 2024
ebd8a9d
code review comments addressed
nkinnan Aug 31, 2024
a478e5e
lint
nkinnan Aug 31, 2024
776d231
revert CR change due to CR comment updated
nkinnan Aug 31, 2024
23c5522
Merge branch 'main' into main
nkinnan Aug 31, 2024
d0527e3
Update Modules/socketmodule.c
nkinnan Sep 3, 2024
9ad2430
Merge branch 'python:main' into main
nkinnan Sep 3, 2024
fe453bc
move test case, remove test support code from asyncio
nkinnan Sep 3, 2024
ec053ad
typo
nkinnan Sep 3, 2024
8c06855
revert change to different test case
nkinnan Sep 3, 2024
d7cb426
whitespace
nkinnan Sep 3, 2024
1bc9b7a
whitespace
nkinnan Sep 3, 2024
9cadf5b
Merge branch 'main' into main
nkinnan Sep 4, 2024
e9a39b6
test blocking path only for now
nkinnan Sep 5, 2024
4b0f5db
Merge branch 'main' of https://github.com/nkinnan/cpython into main
nkinnan Sep 5, 2024
559bbcb
whitespace
nkinnan Sep 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move test case, remove test support code from asyncio
  • Loading branch information
nkinnan committed Sep 3, 2024
commit fe453bcdb9a49d73e25a42303cf86249e9640c76
11 changes: 0 additions & 11 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,6 @@ def _set_nodelay(sock):
pass


if hasattr(socket, 'TCP_QUICKACK'):
def _set_quickack(sock, val):
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_QUICKACK, val)
else:
def _set_quickack(sock, val):
pass


def _check_ssl_socket(sock):
if ssl is not None and isinstance(sock, ssl.SSLSocket):
raise TypeError("Socket cannot be of type SSLSocket")
Expand Down
30 changes: 0 additions & 30 deletions Lib/test/test_asyncio/test_base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -2228,35 +2228,5 @@ def test_set_nodelay(self):
self.check_set_nodelay(sock)


def check_set_quickack(self, sock):
# quickack already true by default on some OSes
opt = sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK)
if opt:
base_events._set_quickack(sock, 0)

opt = sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK)
self.assertFalse(opt)

base_events._set_quickack(sock, 1)

opt = sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK)
self.assertTrue(opt)

@unittest.skipUnless(hasattr(socket, 'TCP_QUICKACK'),
'need socket.TCP_QUICKACK')
def test_set_quickack(self):
with self.subTest('non-blocking'):
sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM,
proto=socket.IPPROTO_TCP)
with sock:
self.check_set_quickack(sock)
with self.subTest('blocking'):
sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM,
proto=socket.IPPROTO_TCP)
with sock:
sock.setblocking(False)
self.check_set_quickack(sock)


if __name__ == '__main__':
unittest.main()
29 changes: 29 additions & 0 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -6826,6 +6826,35 @@ class TestMacOSTCPFlags(unittest.TestCase):
def test_tcp_keepalive(self):
self.assertTrue(socket.TCP_KEEPALIVE)

class TestQuickackFlag(unittest.TestCase):
def test_tcp_keepalive(self):
self.assertTrue(socket.TCP_KEEPALIVE)

@unittest.skipUnless(hasattr(socket, 'TCP_QUICKACK'), 'need socket.TCP_QUICKACK')
class TestQuickackFlag(unittest.TestCase):
def check_set_quickack(self, sock):
# quickack already true by default on some OS distributions
opt = sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK)
if opt:
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK, 0)

opt = sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK)
self.assertFalse(opt)

sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK, 1)

opt = sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_QUICKACK)
self.assertTrue(opt)

def test_set_quickack(self):
for blocking in (False, True):
with self.subTest(blocking=blocking):
Comment thread
nkinnan marked this conversation as resolved.
Outdated
sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM,
proto=socket.IPPROTO_TCP)
with sock:
sock.setblocking(blocking)
self.check_set_quickack(sock)


@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
class TestMSWindowsTCPFlags(unittest.TestCase):
Expand Down