diff --git a/portal/__init__.py b/portal/__init__.py index f07b1e5..9e55272 100644 --- a/portal/__init__.py +++ b/portal/__init__.py @@ -1,4 +1,4 @@ -__version__ = '3.5.0' +__version__ = '3.5.1' import multiprocessing as mp try: diff --git a/portal/client_socket.py b/portal/client_socket.py index 2187e06..1883b2b 100644 --- a/portal/client_socket.py +++ b/portal/client_socket.py @@ -238,9 +238,10 @@ def _create(self): sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, after) sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, every) sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, fails) - sock.setsockopt( - socket.IPPROTO_TCP, socket.TCP_USER_TIMEOUT, - 1000 * (after + every * fails)) + if hasattr(socket, 'TCP_USER_TIMEOUT'): # Linux + sock.setsockopt( + socket.IPPROTO_TCP, socket.TCP_USER_TIMEOUT, + 1000 * (after + every * fails)) if sys.platform == 'darwin': sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPALIVE, every)