| 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 | |
| 190 | class _CallbackData: |