Decouple connection_ap_handshake_attach_circuit from nearly everything.
Long ago we used to call connection_ap_handshake_attach_circuit() only in a few places, since connection_ap_attach_pending() attaches all the pending connections, and does so regularly. But this turned out to have a performance problem: it would introduce a delay to launching or connecting a stream.
We couldn't just call connection_ap_attach_pending() every time we make a new connection, since it walks the whole connection list. So we started calling connection_ap_attach_pending all over, instead! But that's kind of ugly and messes up our callgraph.
But we have an opportunity to make Tor simpler!
- We can make connection_ap_attach_pending() linear in the number of pending entry connections, rather than in the number of total connections.
- If we do that, we can make it get called from whenever there is a pending entry connection from run_main_loop_once() or somewhere.
- And if we do that, we can just put connections on a pending-list, rather than calling connection_ap_attach_pending() on them directly.
This will simplify tor, simplify our callgraph, and -- with the help of #17589 (moved) -- break the blob into multiple smaller strongly connected components.