gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux >= 6.10 (#120227)

The worst case is that the kernel buffers 17 pages with a page size of 64k.
This commit is contained in:
Xi Ruoyao 2024-06-07 23:51:32 +08:00 committed by GitHub
parent 10fb1b8f36
commit a758424566
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 7 deletions

View File

@ -93,13 +93,10 @@ class MyProto(asyncio.Protocol):
class SendfileBase: class SendfileBase:
# 256 KiB plus small unaligned to buffer chunk # Linux >= 6.10 seems buffering up to 17 pages of data.
# Newer versions of Windows seems to have increased its internal # So DATA should be large enough to make this test reliable even with a
# buffer and tries to send as much of the data as it can as it # 64 KiB page configuration.
# has some form of buffering for this which is less than 256KiB DATA = b"x" * (1024 * 17 * 64 + 1)
# on newer server versions and Windows 11.
# So DATA should be larger than 256 KiB to make this test reliable.
DATA = b"x" * (1024 * 256 + 1)
# Reduce socket buffer size to test on relative small data sets. # Reduce socket buffer size to test on relative small data sets.
BUF_SIZE = 4 * 1024 # 4 KiB BUF_SIZE = 4 * 1024 # 4 KiB