aboutsummaryrefslogtreecommitdiffstats
path: root/Pubnub.py
diff options
context:
space:
mode:
authorDevendra2015-04-24 10:47:07 +0530
committerDevendra2015-04-24 10:47:07 +0530
commit3aa150b81bf7f0159086ce0ec61b9171fdeb670a (patch)
tree61957598066638f0d9184596d8b291a4d047de80 /Pubnub.py
parent51c546fbb00d7cc02af1c6cdace19b3cf3e1b7a2 (diff)
downloadpubnub-python-3aa150b81bf7f0159086ce0ec61b9171fdeb670a.tar.bz2
merging osx 10.9 fix from Jay to develop
Diffstat (limited to 'Pubnub.py')
-rw-r--r--Pubnub.py16
1 files changed, 15 insertions, 1 deletions
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