Opened 10 years ago
Closed 10 years ago
#262 closed enhancement (fixed)
allow `IConnectionHintHandler.hint_to_endpoint` to return a Deferred
| Reported by: | Brian Warner | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 0.12.0 |
| Component: | network | Version: | 0.9.1 |
| Keywords: | Cc: |
Description
hint_to_endpoint() should be able to return a Deferred (which fires with a tuple), rather than being required to return the tuple synchronously.
That should make #246 (the Tor handler) easier to write. I'd like it to connect to (or launch) a Tor instance first, then learn the SOCKS port, then return a SOCKS endpoint using that port.
To do this with a synchronous hint_to_endpoint(), it needs to create a custom Endpoint class that waits for the Tor connection/launch in its connect() method, so we couldn't re-use the SOCKS endpoint code.
This will require some work in connection.TubConnector.connectToAll, to wrap a maybeDeferred() around the call to get_endpoint, and to detect NoLocationHintsError differently.
(I should have done this the first time around, but it looked too hard)

Closed by [cd249ed4].