MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _async_socket_receive

Function _async_socket_receive

pymongo/network_layer.py:275–285  ·  view source on GitHub ↗
(
    conn: socket.socket, length: int, loop: AbstractEventLoop
)

Source from the content-addressed store, hash-verified

273
274
275async def _async_socket_receive(
276 conn: socket.socket, length: int, loop: AbstractEventLoop
277) -> memoryview:
278 mv = memoryview(bytearray(length))
279 bytes_read = 0
280 while bytes_read < length:
281 chunk_length = await loop.sock_recv_into(conn, mv[bytes_read:])
282 if chunk_length == 0:
283 raise OSError("connection closed")
284 bytes_read += chunk_length
285 return mv
286
287
288_PYPY = "PyPy" in sys.version

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected