add keep alive setting
This commit is contained in:
parent
82df4524d1
commit
4a291ff335
1 changed files with 5 additions and 0 deletions
|
@ -563,6 +563,11 @@ class TCPRelayHandler(object):
|
||||||
remote_sock_v6.setblocking(False)
|
remote_sock_v6.setblocking(False)
|
||||||
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_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)
|
||||||
|
|
||||||
if not self._is_local:
|
if not self._is_local:
|
||||||
bind_addr = ''
|
bind_addr = ''
|
||||||
if self._bind and af == socket.AF_INET:
|
if self._bind and af == socket.AF_INET:
|
||||||
|
|
Loading…
Add table
Reference in a new issue