Skip to content

Commit f2f75fc

Browse files
authored
PYTHON-4659 Fix async with TLS (mongodb#1793)
1 parent f69d330 commit f2f75fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pymongo/network_layer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ async def async_sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> Non
7777
async def _async_sendall_ssl(
7878
sock: Union[socket.socket, _sslConn], buf: bytes, loop: AbstractEventLoop
7979
) -> None:
80+
view = memoryview(buf)
8081
fd = sock.fileno()
8182
sent = 0
8283

@@ -89,7 +90,7 @@ def _is_ready(fut: Future) -> None:
8990

9091
while sent < len(buf):
9192
try:
92-
sent += sock.send(buf)
93+
sent += sock.send(view[sent:])
9394
except BLOCKING_IO_ERRORS as exc:
9495
fd = sock.fileno()
9596
# Check for closed socket.

0 commit comments

Comments
 (0)