Implement Path use bias accounting.

Path use bias measures how often we can actually succeed using the circuits we
actually try to use. It is a subset of path bias accounting, but it is
computed as a separate statistic because the rate of client circuit use may
vary depending on use case.
Roll back the path_state for circs if we detatch a stream.

An adversary could let the first stream request succeed (ie the resolve), but
then tag and timeout the remainder (via cell dropping), forcing them on new
circuits.

Rolling back the state will cause us to probe such circuits, which should lead
to probe failures in the event of such tagging due to either unrecognized
cells coming in while we wait for the probe, or the cipher state getting out
of sync in the case of dropped cells.
Don't immediately count cannibalized circs as used.

Since they use RELAY_EARLY (which can be seen by all hops on the path),
it's not safe to say they actually count as a successful use.

There are also problems with trying to allow them to finish extending due to
the circuit purpose state machine logic. It is way less complicated (and
possibly more semantically coherent) to simply wait until we actually try to
do something with them before claiming we 'used' them.

Also, we shouldn't call timed out circuits 'used' either, for semantic
consistency.
Remove a source of error during path bias scaling

If any circuits were opened during a scaling event, we were scaling attempts
and successes by different amounts. This leads to rounding error.

The fix is to record how many circuits are in a state that hasn't been fully
counted yet, and subtract that before scaling, and add it back afterwords.
Document path use bias options in the manpage.
Bug 7802 changes file.
squash! Remove a source of error during path bias scaling

Move a log message about scaling to after we scale
Prevent early close of path bias testing circuits.

We need to let them live long enough to perform the test.
squash! Implement Path use bias accounting.

Make a debug log more informative.
squash! Remove a source of error during path bias scaling

Improve debug logs and fix a state fencepost error.
Bug 8024: Check for null/closed channel before probing.
Merge branch 'bug7802' of ssh://git-rw.torproject.org/mikeperry/tor