From e8454cf9b15cc390ee093ed5572eb15cbaa56c3b Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sun, 30 Dec 2012 14:47:24 +0800 Subject: [PATCH] add TCP_NODELAY --- local.py | 1 + server.py | 1 + 2 files changed, 2 insertions(+) diff --git a/local.py b/local.py index 25121b4..f0e889f 100755 --- a/local.py +++ b/local.py @@ -134,6 +134,7 @@ class Socks5Server(SocketServer.StreamRequestHandler): remote = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) else: remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + remote.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) remote.connect((SERVER, REMOTE_PORT)) self.send_encrypt(remote, addr_to_send) logging.info('connecting %s:%d' % (addr, port[0])) diff --git a/server.py b/server.py index 35f2a51..3beddca 100755 --- a/server.py +++ b/server.py @@ -112,6 +112,7 @@ class Socks5Server(SocketServer.StreamRequestHandler): try: logging.info('connecting %s:%d' % (addr, port[0])) remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + remote.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) remote.connect((addr, port[0])) except socket.error, e: # Connection refused