Skip to content

Commit b9576c1

Browse files
committed
Fix NpipeSocket.settimeout to match expected behavior
Signed-off-by: Joffrey F <[email protected]>
1 parent 6f5e19f commit b9576c1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docker/transport/npipesocket.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,16 @@ def setblocking(self, flag):
169169

170170
def settimeout(self, value):
171171
if value is None:
172-
self._timeout = win32pipe.NMPWAIT_NOWAIT
172+
# Blocking mode
173+
self._timeout = win32pipe.NMPWAIT_WAIT_FOREVER
173174
elif not isinstance(value, (float, int)) or value < 0:
174175
raise ValueError('Timeout value out of range')
175176
elif value == 0:
176-
self._timeout = win32pipe.NMPWAIT_USE_DEFAULT_WAIT
177+
# Non-blocking mode
178+
self._timeout = win32pipe.NMPWAIT_NO_WAIT
177179
else:
178-
self._timeout = value
180+
# Timeout mode - Value converted to milliseconds
181+
self._timeout = value * 1000
179182

180183
def gettimeout(self):
181184
return self._timeout

0 commit comments

Comments
 (0)