Skip to content

Commit 2a77285

Browse files
committed
Typing fixes + comment
1 parent 72303d6 commit 2a77285

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

pymongo/asynchronous/encryption.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ async def kms_request(self, kms_context: MongoCryptKmsContext) -> None:
183183
if _IS_SYNC:
184184
data = conn.recv(kms_context.bytes_needed)
185185
else:
186-
from pymongo.network_layer import (
187-
async_receive_data_socket, # type: ignore[attr-defined]
186+
from pymongo.network_layer import ( # type: ignore[attr-defined]
187+
async_receive_data_socket,
188188
)
189189

190190
data = await async_receive_data_socket(conn, kms_context.bytes_needed)

pymongo/network_layer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def _is_ready(fut: Future) -> None:
145145
read = conn.recv_into(mv[total_read:])
146146
if read == 0:
147147
raise OSError("connection closed")
148+
# KMS responses update their expected size after the first batch, stop reading after one loop
148149
if once:
149150
return mv[:read]
150151
total_read += read

pymongo/synchronous/encryption.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ def kms_request(self, kms_context: MongoCryptKmsContext) -> None:
183183
if _IS_SYNC:
184184
data = conn.recv(kms_context.bytes_needed)
185185
else:
186-
from pymongo.network_layer import (
187-
receive_data_socket, # type: ignore[attr-defined]
186+
from pymongo.network_layer import ( # type: ignore[attr-defined]
187+
receive_data_socket,
188188
)
189189

190190
data = receive_data_socket(conn, kms_context.bytes_needed)

0 commit comments

Comments
 (0)