Commit 22da0af4 authored by Antoine Millet's avatar Antoine Millet

Addded an option (default disabled) to enable tcp keepalive

parent ce0aad43
......@@ -59,7 +59,8 @@ class RpcConnection(object):
'write': select.POLLOUT, 'hup': select.POLLHUP,
'error': select.POLLERR | select.POLLNVAL}
def __init__(self, sock, loop=None, *args, **kwargs):
def __init__(self, sock, loop=None, enable_tcp_keepalive=False,
*args, **kwargs):
# Sock of this connection:
self._sock = sock
sock.setblocking(False)
......@@ -71,7 +72,8 @@ class RpcConnection(object):
self.loop = loop
# Activate TCP keepalive on the connection:
#self._sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
if enable_tcp_keepalive:
self._sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
# Watcher list:
self._watchers = set()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment