Call do_handshake() on the sslobject and return the sent data. If do_handshake() fails more than *max_retry* times, return None.
(sslobject, outgoing, max_retry=25)
| 386 | |
| 387 | |
| 388 | def do_ssl_object_handshake(sslobject, outgoing, max_retry=25): |
| 389 | """Call do_handshake() on the sslobject and return the sent data. |
| 390 | |
| 391 | If do_handshake() fails more than *max_retry* times, return None. |
| 392 | """ |
| 393 | data, attempt = None, 0 |
| 394 | while not data and attempt < max_retry: |
| 395 | with contextlib.suppress(ssl.SSLWantReadError): |
| 396 | sslobject.do_handshake() |
| 397 | data = outgoing.read() |
| 398 | attempt += 1 |
| 399 | return data |
| 400 | |
| 401 | |
| 402 | class BasicSocketTests(unittest.TestCase): |
no test coverage detected
searching dependent graphs…