summaryrefslogtreecommitdiff
path: root/docker/utils
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2018-06-05 10:51:54 -0700
committerJoffrey F <f.joffrey@gmail.com>2018-06-06 17:53:50 -0700
commitdbe52dcb7d5765352faa43ab0210fddbcb546431 (patch)
tree81fc2e6bae8ea6e82a4e8e49a55709dd669506c0 /docker/utils
parent49bb7386a3a3752dca64b411a6996663ed04ea1e (diff)
downloaddocker-py-dbe52dcb7d5765352faa43ab0210fddbcb546431.tar.gz
Fix socket reading function for TCP (non-HTTPS) connections on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/utils')
-rw-r--r--docker/utils/socket.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/docker/utils/socket.py b/docker/utils/socket.py
index 0945f0a..7b96d4f 100644
--- a/docker/utils/socket.py
+++ b/docker/utils/socket.py
@@ -1,6 +1,7 @@
import errno
import os
import select
+import socket as pysocket
import struct
import six
@@ -28,6 +29,8 @@ def read(socket, n=4096):
try:
if hasattr(socket, 'recv'):
return socket.recv(n)
+ if six.PY3 and isinstance(socket, getattr(pysocket, 'SocketIO')):
+ return socket.read(n)
return os.read(socket.fileno(), n)
except EnvironmentError as e:
if e.errno not in recoverable_errors: