Wait for the initial SSL handshake to complete. If a ``callback`` is given, it will be called with no arguments once the handshake is complete; otherwise this method returns a `.Future` which will resolve to the stream itself after the handshake is complete.
(self)
| 1472 | self._add_io_state(old_state) |
| 1473 | |
| 1474 | def wait_for_handshake(self) -> "Future[SSLIOStream]": |
| 1475 | """Wait for the initial SSL handshake to complete. |
| 1476 | |
| 1477 | If a ``callback`` is given, it will be called with no |
| 1478 | arguments once the handshake is complete; otherwise this |
| 1479 | method returns a `.Future` which will resolve to the |
| 1480 | stream itself after the handshake is complete. |
| 1481 | |
| 1482 | Once the handshake is complete, information such as |
| 1483 | the peer's certificate and NPN/ALPN selections may be |
| 1484 | accessed on ``self.socket``. |
| 1485 | |
| 1486 | This method is intended for use on server-side streams |
| 1487 | or after using `IOStream.start_tls`; it should not be used |
| 1488 | with `IOStream.connect` (which already waits for the |
| 1489 | handshake to complete). It may only be called once per stream. |
| 1490 | |
| 1491 | .. versionadded:: 4.2 |
| 1492 | |
| 1493 | .. versionchanged:: 6.0 |
| 1494 | |
| 1495 | The ``callback`` argument was removed. Use the returned |
| 1496 | `.Future` instead. |
| 1497 | |
| 1498 | """ |
| 1499 | if self._ssl_connect_future is not None: |
| 1500 | raise RuntimeError("Already waiting") |
| 1501 | future = self._ssl_connect_future = Future() |
| 1502 | if not self._ssl_accepting: |
| 1503 | self._finish_ssl_connect() |
| 1504 | return future |
| 1505 | |
| 1506 | def write_to_fd(self, data: memoryview) -> int: |
| 1507 | # clip buffer size at 1GB since SSL sockets only support upto 2GB |