aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2012-11-20 01:52:33 -0800
committerMike Perry <mikeperry-git@fscked.org>2012-12-07 15:28:38 -0800
commitc3028edba6f8474175a59ad22dd0d3ca23c60f85 (patch)
tree6c479d1cea6dfa63405c3f11f46b348bdbfa56d2 /src
parenta630726884c434323d6af558b80f992fc018d255 (diff)
downloadtor-c3028edba6f8474175a59ad22dd0d3ca23c60f85.tar
tor-c3028edba6f8474175a59ad22dd0d3ca23c60f85.tar.gz
Remove n_chan codepaths for determinining guard.
Cpath is apparently good enough.
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 160ad3f1f..aaa195970 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1308,9 +1308,6 @@ pathbias_count_success(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_digest);
- } else if (circ->base_.n_chan) {
- guard =
- entry_guard_get_by_id_digest(circ->base_.n_chan->identity_digest);
}
if (guard) {
@@ -1387,11 +1384,8 @@ pathbias_count_successful_close(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_digest);
- } else if (circ->base_.n_chan) {
- guard =
- entry_guard_get_by_id_digest(circ->base_.n_chan->identity_digest);
}
-
+
if (guard) {
/* In the long run: circuit_success ~= successful_circuit_close +
* circ_failure + stream_failure */
@@ -1428,11 +1422,8 @@ pathbias_count_collapse(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_digest);
- } else if (circ->base_.n_chan) {
- guard =
- entry_guard_get_by_id_digest(circ->base_.n_chan->identity_digest);
}
-
+
if (guard) {
guard->collapsed_circuits++;
entry_guards_changed();
@@ -1459,11 +1450,8 @@ pathbias_count_unusable(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_digest);
- } else if (circ->base_.n_chan) {
- guard =
- entry_guard_get_by_id_digest(circ->base_.n_chan->identity_digest);
}
-
+
if (guard) {
guard->unusable_circuits++;
entry_guards_changed();
@@ -1496,9 +1484,6 @@ pathbias_count_timeout(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_digest);
- } else if (circ->base_.n_chan) {
- guard =
- entry_guard_get_by_id_digest(circ->base_.n_chan->identity_digest);
}
if (guard) {
@@ -1517,11 +1502,14 @@ pathbias_get_closed_count(entry_guard_t *guard)
/* Count currently open circuits. Give them the benefit of the doubt */
for ( ; circ; circ = circ->next) {
if (!CIRCUIT_IS_ORIGIN(circ) || /* didn't originate here */
- circ->marked_for_close) /* already counted */
+ circ->marked_for_close || /* already counted */
+ !circ->cpath || !circ->cpath->extend_info)
continue;
if (TO_ORIGIN_CIRCUIT(circ)->path_state == PATH_STATE_SUCCEEDED &&
- (memcmp(guard->identity, circ->n_chan->identity_digest, DIGEST_LEN)
+ (memcmp(guard->identity,
+ TO_ORIGIN_CIRCUIT(circ)->cpath->extend_info->identity_digest,
+ DIGEST_LEN)
== 0)) {
open_circuits++;
}