(self)
| 1444 | return self.wait_for_handshake() |
| 1445 | |
| 1446 | def _handle_connect(self) -> None: |
| 1447 | # Call the superclass method to check for errors. |
| 1448 | super()._handle_connect() |
| 1449 | if self.closed(): |
| 1450 | return |
| 1451 | # When the connection is complete, wrap the socket for SSL |
| 1452 | # traffic. Note that we do this by overriding _handle_connect |
| 1453 | # instead of by passing a callback to super().connect because |
| 1454 | # user callbacks are enqueued asynchronously on the IOLoop, |
| 1455 | # but since _handle_events calls _handle_connect immediately |
| 1456 | # followed by _handle_write we need this to be synchronous. |
| 1457 | # |
| 1458 | # The IOLoop will get confused if we swap out self.socket while the |
| 1459 | # fd is registered, so remove it now and re-register after |
| 1460 | # wrap_socket(). |
| 1461 | self.io_loop.remove_handler(self.socket) |
| 1462 | old_state = self._state |
| 1463 | assert old_state is not None |
| 1464 | self._state = None |
| 1465 | self.socket = ssl_wrap_socket( |
| 1466 | self.socket, |
| 1467 | self._ssl_options, |
| 1468 | server_hostname=self._server_hostname, |
| 1469 | do_handshake_on_connect=False, |
| 1470 | server_side=False, |
| 1471 | ) |
| 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. |
nothing calls this directly
no test coverage detected