diff options
author | Brant Knudson <bknudson@us.ibm.com> | 2015-08-02 11:18:45 -0500 |
---|---|---|
committer | Brant Knudson <bknudson@us.ibm.com> | 2015-08-02 11:18:45 -0500 |
commit | aa5738c23de6b88ff98ad649bef7b023d71a1b02 (patch) | |
tree | 42c3b68a343e8c24c54654853982e3a00e883342 /keystoneclient/session.py | |
parent | 9e470a5d7757b97ef74a8c3ecdd95852221db450 (diff) | |
download | python-keystoneclient-aa5738c23de6b88ff98ad649bef7b023d71a1b02.tar.gz |
Remove check for requests version
requirements.txt has requests>=2.5.2, so requests version is always
going to be >= 2.4.1 and there's no need to check it.
Change-Id: I8069cfbd54ce716979bc991d137bd2e71790a1e4
Diffstat (limited to 'keystoneclient/session.py')
-rw-r--r-- | keystoneclient/session.py | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/keystoneclient/session.py b/keystoneclient/session.py index d353c98..a3c7a6f 100644 --- a/keystoneclient/session.py +++ b/keystoneclient/session.py @@ -906,29 +906,28 @@ class TCPKeepAliveAdapter(requests.adapters.HTTPAdapter): http://blogs.msdn.com/b/windowsazurestorage/archive/2010/06/25/nagle-s-algorithm-is-not-friendly-towards-small-requests.aspx """ def init_poolmanager(self, *args, **kwargs): - if requests.__version__ >= '2.4.1': - socket_options = [ - # Keep Nagle's algorithm off - (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1), - # Turn on TCP Keep-Alive - (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), - # Set the maximum number of keep-alive probes - (socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 4), - # Send keep-alive probes every 15 seconds - (socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 15), + socket_options = [ + # Keep Nagle's algorithm off + (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1), + # Turn on TCP Keep-Alive + (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), + # Set the maximum number of keep-alive probes + (socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 4), + # Send keep-alive probes every 15 seconds + (socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 15), + ] + + # Some operating systems (e.g., OSX) do not support setting + # keepidle + if hasattr(socket, 'TCP_KEEPIDLE'): + socket_options += [ + # Wait 60 seconds before sending keep-alive probes + (socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60) ] - # Some operating systems (e.g., OSX) do not support setting - # keepidle - if hasattr(socket, 'TCP_KEEPIDLE'): - socket_options += [ - # Wait 60 seconds before sending keep-alive probes - (socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 60) - ] - - # After waiting 60 seconds, and then sending a probe once every 15 - # seconds 4 times, these options should ensure that a connection - # hands for no longer than 2 minutes before a ConnectionError is - # raised. - kwargs.setdefault('socket_options', socket_options) + # After waiting 60 seconds, and then sending a probe once every 15 + # seconds 4 times, these options should ensure that a connection + # hands for no longer than 2 minutes before a ConnectionError is + # raised. + kwargs.setdefault('socket_options', socket_options) super(TCPKeepAliveAdapter, self).init_poolmanager(*args, **kwargs) |