Skip to content
Snippets Groups Projects
Commit 22da0af4 authored by Antoine Millet's avatar Antoine Millet
Browse files

Addded an option (default disabled) to enable tcp keepalive

parent ce0aad43
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment