The ``ssl_options`` keyword argument may either be an `ssl.SSLContext` object or a dictionary of keywords arguments for `ssl.wrap_socket`
(self, *args: Any, **kwargs: Any)
| 1353 | socket = None # type: ssl.SSLSocket |
| 1354 | |
| 1355 | def __init__(self, *args: Any, **kwargs: Any) -> None: |
| 1356 | """The ``ssl_options`` keyword argument may either be an |
| 1357 | `ssl.SSLContext` object or a dictionary of keywords arguments |
| 1358 | for `ssl.wrap_socket` |
| 1359 | """ |
| 1360 | self._ssl_options = kwargs.pop("ssl_options", _client_ssl_defaults) |
| 1361 | super().__init__(*args, **kwargs) |
| 1362 | self._ssl_accepting = True |
| 1363 | self._handshake_reading = False |
| 1364 | self._handshake_writing = False |
| 1365 | self._server_hostname = None # type: Optional[str] |
| 1366 | |
| 1367 | # If the socket is already connected, attempt to start the handshake. |
| 1368 | try: |
| 1369 | self.socket.getpeername() |
| 1370 | except socket.error: |
| 1371 | pass |
| 1372 | else: |
| 1373 | # Indirectly start the handshake, which will run on the next |
| 1374 | # IOLoop iteration and then the real IO state will be set in |
| 1375 | # _handle_events. |
| 1376 | self._add_io_state(self.io_loop.WRITE) |
| 1377 | |
| 1378 | def reading(self) -> bool: |
| 1379 | return self._handshake_reading or super().reading() |
nothing calls this directly
no test coverage detected