[ARVADOS] updated: cfcefb3de7406b1de3af3765fdb6f8c070bbfa23

git at public.curoverse.com git at public.curoverse.com
Wed Apr 29 10:55:42 EDT 2015


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

       via  cfcefb3de7406b1de3af3765fdb6f8c070bbfa23 (commit)
      from  20b988d5b901f459f95043c3702f1f9b104f3fbf (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 cfcefb3de7406b1de3af3765fdb6f8c070bbfa23
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Apr 29 10:57:47 2015 -0400

    5562: Enable TCP Keepalive for Keep requests. refs #5822

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index b26285e..0383df9 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -340,6 +340,12 @@ class KeepClient(object):
             except:
                 ua.close()
 
+        def _socket_open(self, family, socktype, protocol, address):
+            """Because pycurl doesn't have CURLOPT_TCP_KEEPALIVE"""
+            s = socket.socket(family, socktype, protocol)
+            s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
+            return s
+
         def get(self, locator, timeout=None):
             # locator is a KeepLocator object.
             url = self.root + str(locator)
@@ -350,6 +356,7 @@ class KeepClient(object):
                     self._headers = {}
                     response_body = StringIO.StringIO()
                     curl.setopt(pycurl.NOSIGNAL, 1)
+                    curl.setopt(pycurl.OPENSOCKETFUNCTION, self._socket_open)
                     curl.setopt(pycurl.URL, url.encode('utf-8'))
                     curl.setopt(pycurl.HTTPHEADER, [
                         '{}: {}'.format(k,v) for k,v in self.get_headers.iteritems()])
@@ -406,6 +413,7 @@ class KeepClient(object):
                 self._headers = {}
                 response_body = StringIO.StringIO()
                 curl.setopt(pycurl.NOSIGNAL, 1)
+                curl.setopt(pycurl.OPENSOCKETFUNCTION, self._socket_open)
                 curl.setopt(pycurl.URL, url.encode('utf-8'))
                 curl.setopt(pycurl.POSTFIELDS, body)
                 curl.setopt(pycurl.CUSTOMREQUEST, 'PUT')

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list