diff options
Diffstat (limited to 'Pubnub.py')
| -rw-r--r-- | Pubnub.py | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -79,7 +79,21 @@ if sys.platform.startswith("linux"): ] elif sys.platform.startswith("darwin"): # From /usr/include/netinet/tcp.h - socket.TCP_KEEPALIVE = 0x10 # idle time used when SO_KEEPALIVE is enabled + + # idle time used when SO_KEEPALIVE is enabled + socket.TCP_KEEPALIVE = socket.TCP_KEEPALIVE \ + if hasattr(socket, 'TCP_KEEPALIVE') \ + else 0x10 + + # interval between keepalives + socket.TCP_KEEPINTVL = socket.TCP_KEEPINTVL \ + if hasattr(socket, 'TCP_KEEPINTVL') \ + else 0x101 + + # number of keepalives before close + socket.TCP_KEEPCNT = socket.TCP_KEEPCNT \ + if hasattr(socket, 'TCP_KEEPCNT') \ + else 0x102 default_socket_options += [ # Send first keepalive packet 200 seconds after last data packet |
