From 2d63e684947b93c940864df5876e055d75eedf20 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 10 Jan 2019 15:17:34 -0500 Subject: [PATCH] Enable support for TCP_FASTOPEN It might matter in some context. --- confluent_server/confluent/httpapi.py | 2 ++ confluent_server/confluent/sockapi.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index a0fbb4ad..d8822192 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -789,6 +789,8 @@ def serve(bind_host, bind_port): 'Failed to open HTTP due to busy port, trying again in' ' a second\n') eventlet.sleep(1) + # TCP_FASTOPEN + sock.setsockopt(socket.SOL_TCP, 23, 5) eventlet.wsgi.server(sock, resourcehandler, log=False, log_output=False, debug=False, socket_timeout=60) diff --git a/confluent_server/confluent/sockapi.py b/confluent_server/confluent/sockapi.py index c5ce3a98..a4615fc3 100644 --- a/confluent_server/confluent/sockapi.py +++ b/confluent_server/confluent/sockapi.py @@ -329,6 +329,8 @@ def _tlshandler(bind_host, bind_port): raise sys.stderr.write('TLS Socket in use, retrying in 1 second\n') eventlet.sleep(1) + # Enable TCP_FASTOPEN + plainsocket.setsockopt(socket.SOL_TCP, 23, 5) plainsocket.listen(5) while (1): # TODO: exithook cnn, addr = plainsocket.accept()