Browse Source

Linux only

dev
BreakWa11 9 years ago
parent
commit
292865f625
  1. 2
      shadowsocks/tcprelay.py

2
shadowsocks/tcprelay.py

@ -565,7 +565,7 @@ class TCPRelayHandler(object):
else: else:
remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
remote_sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) remote_sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
if platform.system() != 'Windows': if platform.system() in ['Linux']:
remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 120) 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_KEEPINTVL, 20)
remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, 5) remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, 5)

Loading…
Cancel
Save