From 2779e93cacb8f92a7b45a2559948fb6d3b552594 Mon Sep 17 00:00:00 2001 From: sorz Date: Wed, 30 Aug 2017 03:08:10 +1000 Subject: [PATCH] Set TCP_NODELAY by default To reduce latency. It's already default since Python 3.6, but we need it also on 3.5. --- sstpd/__main__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sstpd/__main__.py b/sstpd/__main__.py index 216ecb3..a8062d1 100755 --- a/sstpd/__main__.py +++ b/sstpd/__main__.py @@ -2,6 +2,7 @@ import sys import logging import argparse +from socket import IPPROTO_TCP, TCP_NODELAY from configparser import SafeConfigParser, NoSectionError import ssl import asyncio @@ -154,6 +155,10 @@ def main(): ssl=ssl_ctx) server = loop.run_until_complete(coro) + if not on_unix_socket: + for sock in server.sockets: + sock.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) + if args.proxy_protocol: logging.info('PROXY PROTOCOL is activated.') if on_unix_socket: