diff --git a/truenas_api_client/utils.py b/truenas_api_client/utils.py index 08bf65c..c784ca1 100644 --- a/truenas_api_client/utils.py +++ b/truenas_api_client/utils.py @@ -136,7 +136,7 @@ def __exit__(self, typ, value, traceback): def set_socket_options(socobj): plat = sys.platform - if plat not in ('linux', 'freebsd', 'darwin'): + if plat not in ('win32', 'linux', 'freebsd', 'darwin'): raise RuntimeError('Unsupported platform') # enable keepalives on the socket @@ -151,10 +151,12 @@ def set_socket_options(socobj): # 3. for a maximum up to 5 times # # after 5 times (5 seconds of no response), the socket will be closed - if plat in ('linux', 'freebsd'): + # pytype: disable=attribute-error + if plat in ('linux', 'freebsd', 'win32'): socobj.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 1) else: socobj.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPALIVE, 1) + # pytype: enable=attribute-error socobj.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 1) socobj.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 5)