PYTHON-4874 - Add KMS support for async Windows (#1939)

This commit is contained in:
Noah Stapp 2024-10-17 11:32:39 -04:00 committed by GitHub
parent 8ce21bc121
commit a62ade864d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -205,7 +205,7 @@ else:
total_sent += sent
async def _async_receive_ssl(
conn: _sslConn, length: int, dummy: AbstractEventLoop
conn: _sslConn, length: int, dummy: AbstractEventLoop, once: Optional[bool] = False
) -> memoryview:
mv = memoryview(bytearray(length))
total_read = 0
@ -215,6 +215,9 @@ else:
while total_read < length:
try:
read = conn.recv_into(mv[total_read:])
# 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: