(self)
| 475 | super().__init__(context, conn or context.server) |
| 476 | |
| 477 | def start_handshake(self) -> layer.CommandGenerator[None]: |
| 478 | wait_for_clienthello = ( |
| 479 | # if command_to_reply_to is set, we've been instructed to open the connection from the child layer. |
| 480 | # in that case any potential ClientHello is already parsed (by the ClientTLS child layer). |
| 481 | not self.command_to_reply_to |
| 482 | # if command_to_reply_to is not set, the connection was already open when this layer received its Start |
| 483 | # event (eager connection strategy). We now want to establish TLS right away, _unless_ we already know |
| 484 | # that there's TLS on the client side as well (we check if our immediate child layer is set to be ClientTLS) |
| 485 | # In this case want to wait for ClientHello to be parsed, so that we can incorporate SNI/ALPN from there. |
| 486 | and isinstance(self.child_layer, ClientTLSLayer) |
| 487 | ) |
| 488 | if wait_for_clienthello: |
| 489 | self.wait_for_clienthello = True |
| 490 | self.tunnel_state = tunnel.TunnelState.CLOSED |
| 491 | else: |
| 492 | yield from self.start_tls() |
| 493 | if self.tls: |
| 494 | yield from self.receive_handshake_data(b"") |
| 495 | |
| 496 | def event_to_child(self, event: events.Event) -> layer.CommandGenerator[None]: |
| 497 | if self.wait_for_clienthello: |
nothing calls this directly
no test coverage detected