Skip to content

Commit

Permalink
Making TCP_KEEPIDLE socket option optional
Browse files Browse the repository at this point in the history
Not all implementations of the python socket library support
TCP_KEEPIDLE, so only try to set it when supported. Fixes bug 879195.

Change-Id: I2f062a346a60c69f52d23f70332d7c9da4ecdf35
  • Loading branch information
Brian Waldon committed Oct 21, 2011
1 parent 5ae43a0 commit efcdac3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion glance/common/wsgi.py
Expand Up @@ -98,7 +98,11 @@ def get_socket(host, port, conf):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# in my experience, sockets can hang around forever without keepalive
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 600)

# This option isn't available in the OS X version of eventlet
if hasattr(socket, 'TCP_KEEPIDLE'):
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 600)

return sock


Expand Down

0 comments on commit efcdac3

Please sign in to comment.