|
|
@ -26,6 +26,7 @@ import logging |
|
|
|
import binascii |
|
|
|
import traceback |
|
|
|
import random |
|
|
|
import platform |
|
|
|
|
|
|
|
from shadowsocks import encrypt, obfs, eventloop, shell, common |
|
|
|
from shadowsocks.common import pre_parse_header, parse_header |
|
|
@ -564,6 +565,7 @@ class TCPRelayHandler(object): |
|
|
|
else: |
|
|
|
remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) |
|
|
|
remote_sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) |
|
|
|
if platform.system() != 'Windows': |
|
|
|
remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 120) |
|
|
|
remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, 20) |
|
|
|
remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, 5) |
|
|
|