diff options
author | Joffrey F <joffrey@docker.com> | 2016-11-02 16:28:23 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2016-11-02 16:28:23 -0700 |
commit | 422bc2beb2d3c7dd46541f2e6ca3b982e5091520 (patch) | |
tree | d3491c7902d18f64b3a21855e0370ddd88481ac2 | |
parent | 4119fa93bd56dceff42125422d949940f5788b80 (diff) | |
download | docker-py-1284-settimeout-fix.tar.gz |
Fix NpipeSocket.settimeout to match expected behavior1284-settimeout-fix
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r-- | docker/transport/npipesocket.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/docker/transport/npipesocket.py b/docker/transport/npipesocket.py index 509cabf..c04b39d 100644 --- a/docker/transport/npipesocket.py +++ b/docker/transport/npipesocket.py @@ -170,13 +170,16 @@ class NpipeSocket(object): def settimeout(self, value): if value is None: - self._timeout = win32pipe.NMPWAIT_NOWAIT + # Blocking mode + self._timeout = win32pipe.NMPWAIT_WAIT_FOREVER elif not isinstance(value, (float, int)) or value < 0: raise ValueError('Timeout value out of range') elif value == 0: - self._timeout = win32pipe.NMPWAIT_USE_DEFAULT_WAIT + # Non-blocking mode + self._timeout = win32pipe.NMPWAIT_NO_WAIT else: - self._timeout = value + # Timeout mode - Value converted to milliseconds + self._timeout = value * 1000 def gettimeout(self): return self._timeout |