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:
parent
e728383c45
commit
b60af2315b
@ -20,6 +20,7 @@ import os
|
|||||||
import random
|
import random
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
@ -867,8 +868,10 @@ class Connection(object):
|
|||||||
LOG.debug('Failed to get socket attribute: %s' % str(e))
|
LOG.debug('Failed to get socket attribute: %s' % str(e))
|
||||||
else:
|
else:
|
||||||
sock.settimeout(timeout)
|
sock.settimeout(timeout)
|
||||||
sock.setsockopt(socket.IPPROTO_TCP, TCP_USER_TIMEOUT,
|
if sys.platform != 'win32':
|
||||||
timeout * 1000 if timeout is not None else 0)
|
sock.setsockopt(socket.IPPROTO_TCP,
|
||||||
|
TCP_USER_TIMEOUT,
|
||||||
|
timeout * 1000 if timeout is not None else 0)
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _transport_socket_timeout(self, timeout):
|
def _transport_socket_timeout(self, timeout):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user