THRIFT-5617: T(SSL)Socket TCP keep-alive incorrectly applies SO_KEEPALIVE to IPPROTO_TCP
Apply socket.SO_KEEPALIVE at the socket.SOL_SOCKET, not socket.IPPROTO_TCP, level
diff --git a/lib/py/src/transport/TSocket.py b/lib/py/src/transport/TSocket.py
index eea5366..ee7b26d 100644
--- a/lib/py/src/transport/TSocket.py
+++ b/lib/py/src/transport/TSocket.py
@@ -131,9 +131,9 @@
for family, socktype, _, _, sockaddr in addrs:
handle = self._do_open(family, socktype)
- # TCP_KEEPALIVE
+ # TCP keep-alive
if self._socket_keepalive:
- handle.setsockopt(socket.IPPROTO_TCP, socket.SO_KEEPALIVE, 1)
+ handle.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
handle.settimeout(self._timeout)
try: