From 542690f9079180e1dbd54868f1ccdf85d4a126c4 Mon Sep 17 00:00:00 2001 From: Antoine Millet Date: Mon, 21 Mar 2011 14:48:42 +0100 Subject: [PATCH] [bug#4062] Added usage of SO_KEEPALIVE flag on sjrpc sockets. --- sjrpc/core/rpcconnection.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sjrpc/core/rpcconnection.py b/sjrpc/core/rpcconnection.py index bd0c898..7b3c007 100644 --- a/sjrpc/core/rpcconnection.py +++ b/sjrpc/core/rpcconnection.py @@ -32,6 +32,9 @@ class RpcConnection(object): def __init__(self, sock, manager, handler=None, timeout=None): # Sock of this connection: self._sock = sock + + # Activate TCP keepalive on the connection: + self._sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) # Inbound buffer containing currently readed message while it sending: self._inbound_buffer = BytesBuffer() -- GitLab