Notably, turn the hashmap into its own type. This will help with
other refactoring and fixes in the future.
Also notably, fix the code we use when a pending circuit is
complete. There's still a design flaw there though.
We now use the unique id of each non-pending circuit as its key in
the map. I wish I could do this without copying, but I don't see a
great way to do that while keeping the pending entries in the same
map for now.
Previously we'd just remember the port that we _wanted_ a circuit
for, and forget all the ports that it _could_ support.
This is part of a bigger circmgr revision/refactoring pass; there
should be cleanups before I merge this.
This makes a whole lot of our code simpler, and makes it so that
CircMgr and DirMgr no longer need to have anything parameterized
over transports, either.
Instead of boxing Transport inside of ChanMgr, I've made a new
Connection trait that goes from a ChanTarget* straight to a Channel.
This lets us avoid having to box the intermediate TLS object.
[*] Actually, a copy of the information from a ChanTarget. Ick, but
I had to make a copy to avoid parameterizing
Connecter::build_channel.
This follows a three-phase process: We are either fetching
microdescriptors, waiting for the time to download the next
consensus, or fetching the next consensus and making it usable.
We can stop fetching microdescriptors for two reasons: by having no
more mds that we need to download, or by running out of time in
which the current consensus is usable.
Rather than having the NetDir own its microdescs and consensus, give
it Arc<>s for them. This way, we can do a shallow copy of a NetDir
to work around mutability issues that would otherwise make it hard
to add microdescs to a netdir on the fly.
This patch fixes a minor typo in the error case when looking for a
middle relay for a 3-hop circuit where the error message should say "No
middle relay found" and not "No exit relay found".