Skip to content

Commit 7e904b3

Browse files
authored
PYTHON-4874 Fix async Windows KMS support (mongodb#1942)
1 parent 317a539 commit 7e904b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pymongo/network_layer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ async def _async_receive_ssl(
215215
while total_read < length:
216216
try:
217217
read = conn.recv_into(mv[total_read:])
218+
if read == 0:
219+
raise OSError("connection closed")
218220
# KMS responses update their expected size after the first batch, stop reading after one loop
219221
if once:
220222
return mv[:read]
221-
if read == 0:
222-
raise OSError("connection closed")
223223
except BLOCKING_IO_ERRORS:
224224
await asyncio.sleep(backoff)
225225
read = 0

0 commit comments

Comments
 (0)