MCPcopy
hub / github.com/tornadoweb/tornado / connect

Method connect

tornado/iostream.py:1427–1444  ·  view source on GitHub ↗
(
        self, address: Tuple, server_hostname: Optional[str] = None
    )

Source from the content-addressed store, hash-verified

1425 super()._handle_write()
1426
1427 def connect(
1428 self, address: Tuple, server_hostname: Optional[str] = None
1429 ) -> "Future[SSLIOStream]":
1430 self._server_hostname = server_hostname
1431 # Ignore the result of connect(). If it fails,
1432 # wait_for_handshake will raise an error too. This is
1433 # necessary for the old semantics of the connect callback
1434 # (which takes no arguments). In 6.0 this can be refactored to
1435 # be a regular coroutine.
1436 # TODO: This is trickier than it looks, since if write()
1437 # is called with a connect() pending, we want the connect
1438 # to resolve before the write. Or do we care about this?
1439 # (There's a test for it, but I think in practice users
1440 # either wait for the connect before performing a write or
1441 # they don't care about the connect Future at all)
1442 fut = super().connect(address)
1443 fut.add_done_callback(lambda f: f.exception())
1444 return self.wait_for_handshake()
1445
1446 def _handle_connect(self) -> None:
1447 # Call the superclass method to check for errors.

Callers 4

connect_to_serverMethod · 0.95
test_matchMethod · 0.95
test_no_matchMethod · 0.95
test_check_disabledMethod · 0.95

Calls 2

wait_for_handshakeMethod · 0.95
connectMethod · 0.45

Tested by 4

connect_to_serverMethod · 0.76
test_matchMethod · 0.76
test_no_matchMethod · 0.76
test_check_disabledMethod · 0.76