Remove n_chan codepaths for determinining guard.

Cpath is apparently good enough.
This commit is contained in:
Mike Perry 2012-11-20 01:52:33 -08:00
parent a630726884
commit c3028edba6

View File

@ -1308,9 +1308,6 @@ pathbias_count_success(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) { if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest( guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_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) { if (guard) {
@ -1387,9 +1384,6 @@ pathbias_count_successful_close(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) { if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest( guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_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) { if (guard) {
@ -1428,9 +1422,6 @@ pathbias_count_collapse(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) { if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest( guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_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) { if (guard) {
@ -1459,9 +1450,6 @@ pathbias_count_unusable(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) { if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest( guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_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) { if (guard) {
@ -1496,9 +1484,6 @@ pathbias_count_timeout(origin_circuit_t *circ)
if (circ->cpath && circ->cpath->extend_info) { if (circ->cpath && circ->cpath->extend_info) {
guard = entry_guard_get_by_id_digest( guard = entry_guard_get_by_id_digest(
circ->cpath->extend_info->identity_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) { 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 */ /* Count currently open circuits. Give them the benefit of the doubt */
for ( ; circ; circ = circ->next) { for ( ; circ; circ = circ->next) {
if (!CIRCUIT_IS_ORIGIN(circ) || /* didn't originate here */ 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; continue;
if (TO_ORIGIN_CIRCUIT(circ)->path_state == PATH_STATE_SUCCEEDED && 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)) { == 0)) {
open_circuits++; open_circuits++;
} }