Fix oslo.messaging for Mac OS X

TCP_USER_TIMEOUT is not defined on Mac OS X, so we should not set it
on that platform.

Change-Id: If745d4981dea24e4267c95473059ff71176ae7d9
Closes-Bug: #1566862
This commit is contained in:
Dmitry Mescheryakov 2016-04-06 19:23:22 +03:00
parent ee394d3c5b
commit 8afa73b43f

View File

@ -868,7 +868,8 @@ class Connection(object):
LOG.debug('Failed to get socket attribute: %s' % str(e))
else:
sock.settimeout(timeout)
if sys.platform != 'win32':
# TCP_USER_TIMEOUT is not defined on Windows and Mac OS X
if sys.platform != 'win32' and sys.platform != 'darwin':
sock.setsockopt(socket.IPPROTO_TCP,
TCP_USER_TIMEOUT,
timeout * 1000 if timeout is not None else 0)