Skip to content

Commit bc6e1c0

Browse files
committed
Restore set TCP_NODELAY on TCP sockets
This reverts commit 74d5b95. The issue wasn't Docker, but rather trying to set TCP properties on a UDP socket, hence the additional condition in this version.
1 parent 7136c61 commit bc6e1c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/hypercorn/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ def _create_sockets(
246246
except (ValueError, IndexError):
247247
host, port = bind, 8000
248248
sock = socket.socket(socket.AF_INET6 if ":" in host else socket.AF_INET, type_)
249+
250+
if type_ == socket.SOCK_STREAM:
251+
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
252+
249253
if self.workers > 1:
250254
try:
251255
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)

0 commit comments

Comments
 (0)