PYTHON-4874 Fix async Windows KMS support (#1942)

This commit is contained in:
Shane Harvey 2024-10-17 13:11:20 -07:00 committed by GitHub
parent 317a539415
commit 7e904b3c31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -215,11 +215,11 @@ else:
while total_read < length:
try:
read = conn.recv_into(mv[total_read:])
if read == 0:
raise OSError("connection closed")
# KMS responses update their expected size after the first batch, stop reading after one loop
if once:
return mv[:read]
if read == 0:
raise OSError("connection closed")
except BLOCKING_IO_ERRORS:
await asyncio.sleep(backoff)
read = 0