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

Method sendall

pymongo/pyopenssl_context.py:169–187  ·  view source on GitHub ↗
(self, buf: bytes, flags: int = 0)

Source from the content-addressed store, hash-verified

167 raise
168
169 def sendall(self, buf: bytes, flags: int = 0) -> None: # type: ignore[override]
170 view = memoryview(buf)
171 total_length = len(buf)
172 total_sent = 0
173 while total_sent < total_length:
174 try:
175 sent = self._call(super().send, view[total_sent:], flags)
176 # XXX: It's not clear if this can actually happen. PyOpenSSL
177 # doesn't appear to have any interrupt handling, nor any interrupt
178 # errors for OpenSSL connections.
179 except OSError as exc:
180 if _errno_from_exception(exc) == _EINTR:
181 continue
182 raise
183 # https://github.com/pyca/pyopenssl/blob/19.1.0/src/OpenSSL/SSL.py#L1756
184 # https://www.openssl.org/docs/man1.0.2/man3/SSL_write.html
185 if sent <= 0:
186 raise OSError("connection closed")
187 total_sent += sent
188
189
190class _CallbackData:

Callers 3

test_socket_checkerMethod · 0.80
test_socket_checkerMethod · 0.80
sendallFunction · 0.80

Calls 2

_callMethod · 0.95
_errno_from_exceptionFunction · 0.90

Tested by 2

test_socket_checkerMethod · 0.64
test_socket_checkerMethod · 0.64