diff --git a/sjrpc/core/rpcconnection.py b/sjrpc/core/rpcconnection.py index bd0c898ad5dec011e4d7db02f08906c5ef8c3c9d..7b3c0070b7d2587f9c65fd2cbc6a3604bdc95d55 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()