Don't build introduction circuits until we know we can build circuits
When the network is disabled and re-enabled via DisableNetwork, Tor will try to build new introduction circuits as soon as the network is re-enabled. The circuits will fail and Tor will wait for five minutes (INTRO_CIRC_RETRY_PERIOD) before trying again.
This patch sets can_complete_circuit to 0 when the network is disabled, and doesn't try to build intro circuits while can_complete_circuit is 0, so when the network is re-enabled Tor will wait for a circuit to be successfully built before trying to build intro circuits.
This should improve the performance of hidden services that use DisableNetwork to respond to connectivity changes, such as services running on mobile devices.
Trac:
Username: akwizgran