Fix Break in Windows platforms

In Ibf6139ac2c22d9eeda7030fb87b7f1139d92332e, we added a
TCP timeout that does not work on Windows (with python 2.7.9)

Closes-Bug: #1562706
Change-Id: I2819225c2d3d3b418c977c03868db8d0c8022d5a
This commit is contained in:
Davanum Srinivas 2016-03-28 06:38:11 -04:00 committed by Davanum Srinivas (dims)
parent e728383c45
commit b60af2315b

View File

@ -20,6 +20,7 @@ import os
import random
import socket
import ssl
import sys
import threading
import time
import uuid
@ -867,8 +868,10 @@ class Connection(object):
LOG.debug('Failed to get socket attribute: %s' % str(e))
else:
sock.settimeout(timeout)
sock.setsockopt(socket.IPPROTO_TCP, TCP_USER_TIMEOUT,
timeout * 1000 if timeout is not None else 0)
if sys.platform != 'win32':
sock.setsockopt(socket.IPPROTO_TCP,
TCP_USER_TIMEOUT,
timeout * 1000 if timeout is not None else 0)
@contextlib.contextmanager
def _transport_socket_timeout(self, timeout):