From 3aa150b81bf7f0159086ce0ec61b9171fdeb670a Mon Sep 17 00:00:00 2001 From: Devendra Date: Fri, 24 Apr 2015 10:47:07 +0530 Subject: merging osx 10.9 fix from Jay to develop --- Pubnub.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Pubnub.py b/Pubnub.py index c2d3bd4..74b511f 100644 --- a/Pubnub.py +++ b/Pubnub.py @@ -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 -- cgit v1.2.3