[ARVADOS] updated: bb5430392e6af88d2a65fa060d9069630a4a7dc2

Git user git at public.curoverse.com
Thu Jul 14 17:08:52 EDT 2016


Summary of changes:
 sdk/python/arvados/keep.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

       via  bb5430392e6af88d2a65fa060d9069630a4a7dc2 (commit)
       via  ea4ac61f1abd5ac3add332227751f22cc6eb329f (commit)
       via  353bc51027bdf085c8b638cbde9dbb38e1fd0262 (commit)
      from  eeddbb297de457834c943d16c49ee0a1192cc2a4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit bb5430392e6af88d2a65fa060d9069630a4a7dc2
Merge: eeddbb2 ea4ac61
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Jul 14 16:47:38 2016 -0400

    Merge branch 'fix-python-sdk-mac' of https://github.com/adambom/arvados
    
    No issue #


commit ea4ac61f1abd5ac3add332227751f22cc6eb329f
Author: Adam Savitzky <adam.savitzky at gmail.com>
Date:   Thu Jul 14 13:38:38 2016 -0700

    Monkey patch socket constants on apple only

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 483ac96..80633b7 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -9,6 +9,7 @@ import Queue
 import re
 import socket
 import ssl
+import sys
 import threading
 import timer
 
@@ -24,12 +25,13 @@ global_client_object = None
 
 # Monkey patch TCP constants when not available (apple). Values sourced from:
 # http://www.opensource.apple.com/source/xnu/xnu-2422.115.4/bsd/netinet/tcp.h
-if not hasattr(socket, 'TCP_KEEPALIVE'):
-    socket.TCP_KEEPALIVE = 0x010
-if not hasattr(socket, 'TCP_KEEPINTVL'):
-    socket.TCP_KEEPINTVL = 0x101
-if not hasattr(socket, 'TCP_KEEPCNT'):
-    socket.TCP_KEEPCNT = 0x102
+if sys.platform == 'darwin':
+    if not hasattr(socket, 'TCP_KEEPALIVE'):
+        socket.TCP_KEEPALIVE = 0x010
+    if not hasattr(socket, 'TCP_KEEPINTVL'):
+        socket.TCP_KEEPINTVL = 0x101
+    if not hasattr(socket, 'TCP_KEEPCNT'):
+        socket.TCP_KEEPCNT = 0x102
 
 
 class KeepLocator(object):

commit 353bc51027bdf085c8b638cbde9dbb38e1fd0262
Author: Adam Savitzky <adam.savitzky at gmail.com>
Date:   Wed Jul 13 15:54:54 2016 -0700

    Patch socket configuration for Apple systems

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 778b909..483ac96 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -22,6 +22,16 @@ _logger = logging.getLogger('arvados.keep')
 global_client_object = None
 
 
+# Monkey patch TCP constants when not available (apple). Values sourced from:
+# http://www.opensource.apple.com/source/xnu/xnu-2422.115.4/bsd/netinet/tcp.h
+if not hasattr(socket, 'TCP_KEEPALIVE'):
+    socket.TCP_KEEPALIVE = 0x010
+if not hasattr(socket, 'TCP_KEEPINTVL'):
+    socket.TCP_KEEPINTVL = 0x101
+if not hasattr(socket, 'TCP_KEEPCNT'):
+    socket.TCP_KEEPCNT = 0x102
+
+
 class KeepLocator(object):
     EPOCH_DATETIME = datetime.datetime.utcfromtimestamp(0)
     HINT_RE = re.compile(r'^[A-Z][A-Za-z0-9 at _-]+$')
@@ -299,7 +309,9 @@ class KeepClient(object):
             """Because pycurl doesn't have CURLOPT_TCP_KEEPALIVE"""
             s = socket.socket(family, socktype, protocol)
             s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
-            s.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 75)
+            # Will throw invalid protocol error on mac. This test prevents that.
+            if hasattr(socket, 'TCP_KEEPIDLE'):
+                s.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 75)
             s.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 75)
             return s
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list