Ports/python3: Add support for TCP_NODELAY

This commit is contained in:
Romain Chardiny 2023-11-08 19:07:24 +01:00 committed by Tim Schumacher
parent eb71950c8b
commit 71d4ab367a
Notes: sideshowbarker 2024-07-17 06:35:16 +09:00
2 changed files with 0 additions and 36 deletions

View File

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Humberto Alves <hjalves@live.com>
Date: Fri, 2 Sep 2022 03:31:42 +0100
Subject: [PATCH] Workaround for unsupported socket option
This is a workaround for ignoring the result of `setsockopt` call when
given `TCP_NODELAY` as an argument. This TCP socket option is used in
many applications (like pip and requests) for optimization purposes.
For now, it can be safely ignored until it's supported in the kernel.
---
Modules/socketmodule.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 9fa20cd95b41bea51ae9ccadc24ec74bf222b695..76160293f9d831b8516d0094bd3ea4039c059eca 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3209,6 +3209,8 @@ sock_setsockopt(PySocketSockObject *s, PyObject *args)
PyBuffer_Release(&optval);
done:
+ if (res < 0 && level == IPPROTO_TCP && optname == TCP_NODELAY && errno == ENOPROTOOPT)
+ res = 0;
if (res < 0) {
return s->errorhandler();
}

View File

@ -21,13 +21,3 @@ Include `sys/uio.h` in `socketmodule.c`
This is to ensure that `struct iovec` is defined, which is required by
the `socket` module.
## `0004-Workaround-for-unsupported-socket-option.patch`
Workaround for unsupported socket option
This is a workaround for ignoring the result of `setsockopt` call when
given `TCP_NODELAY` as an argument. This TCP socket option is used in
many applications (like pip and requests) for optimization purposes.
For now, it can be safely ignored until it's supported in the kernel.