Skip to content

Commit

Permalink
Set TCP_NODELAY by default
Browse files Browse the repository at this point in the history
To reduce latency.
It's already default since Python 3.6, but we need it also on 3.5.
  • Loading branch information
sorz committed Aug 29, 2017
1 parent 81dc17e commit 2779e93
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sstpd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2779e93

Please sign in to comment.