mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Nick's Code review #3 part 2.
This commit is contained in:
parent
b0fc18c37e
commit
406d59a9c9
@ -1350,7 +1350,7 @@ pathbias_count_build_success(origin_circuit_t *circ)
|
|||||||
circ->path_state = PATH_STATE_BUILD_SUCCEEDED;
|
circ->path_state = PATH_STATE_BUILD_SUCCEEDED;
|
||||||
guard->circ_successes++;
|
guard->circ_successes++;
|
||||||
|
|
||||||
log_info(LD_CIRC, "Got success count %lf/%lf for guard %s=%s",
|
log_info(LD_CIRC, "Got success count %f/%f for guard %s=%s",
|
||||||
guard->circ_successes, guard->circ_attempts,
|
guard->circ_successes, guard->circ_attempts,
|
||||||
guard->nickname, hex_str(guard->identity, DIGEST_LEN));
|
guard->nickname, hex_str(guard->identity, DIGEST_LEN));
|
||||||
} else {
|
} else {
|
||||||
@ -1368,7 +1368,7 @@ pathbias_count_build_success(origin_circuit_t *circ)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (guard->circ_attempts < guard->circ_successes) {
|
if (guard->circ_attempts < guard->circ_successes) {
|
||||||
log_notice(LD_BUG, "Unexpectedly high successes counts (%lf/%lf) "
|
log_notice(LD_BUG, "Unexpectedly high successes counts (%f/%f) "
|
||||||
"for guard %s=%s",
|
"for guard %s=%s",
|
||||||
guard->circ_successes, guard->circ_attempts,
|
guard->circ_successes, guard->circ_attempts,
|
||||||
guard->nickname, hex_str(guard->identity, DIGEST_LEN));
|
guard->nickname, hex_str(guard->identity, DIGEST_LEN));
|
||||||
@ -1407,6 +1407,13 @@ pathbias_count_build_success(origin_circuit_t *circ)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a circuit was used and/or closed successfully.
|
* Check if a circuit was used and/or closed successfully.
|
||||||
|
*
|
||||||
|
* If we attempted to use the circuit to carry a stream but failed
|
||||||
|
* for whatever reason, or if the circuit mysteriously died before
|
||||||
|
* we could attach any streams, record these two cases.
|
||||||
|
*
|
||||||
|
* If we *have* successfully used the circuit, or it appears to
|
||||||
|
* have been closed by us locally, count it as a success.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pathbias_check_close(origin_circuit_t *ocirc, int reason)
|
pathbias_check_close(origin_circuit_t *ocirc, int reason)
|
||||||
@ -1751,7 +1758,7 @@ entry_guard_inc_circ_attempt_count(entry_guard_t *guard)
|
|||||||
const int scale_factor = pathbias_get_scale_factor(options);
|
const int scale_factor = pathbias_get_scale_factor(options);
|
||||||
const int mult_factor = pathbias_get_mult_factor(options);
|
const int mult_factor = pathbias_get_mult_factor(options);
|
||||||
log_info(LD_CIRC,
|
log_info(LD_CIRC,
|
||||||
"Scaling pathbias counts to (%lf/%lf)*(%d/%d) for guard %s=%s",
|
"Scaling pathbias counts to (%f/%f)*(%d/%d) for guard %s=%s",
|
||||||
guard->circ_successes, guard->circ_attempts,
|
guard->circ_successes, guard->circ_attempts,
|
||||||
mult_factor, scale_factor, guard->nickname,
|
mult_factor, scale_factor, guard->nickname,
|
||||||
hex_str(guard->identity, DIGEST_LEN));
|
hex_str(guard->identity, DIGEST_LEN));
|
||||||
@ -1771,7 +1778,7 @@ entry_guard_inc_circ_attempt_count(entry_guard_t *guard)
|
|||||||
guard->unusable_circuits /= scale_factor;
|
guard->unusable_circuits /= scale_factor;
|
||||||
}
|
}
|
||||||
guard->circ_attempts++;
|
guard->circ_attempts++;
|
||||||
log_info(LD_CIRC, "Got success count %lf/%lf for guard %s=%s",
|
log_info(LD_CIRC, "Got success count %f/%f for guard %s=%s",
|
||||||
guard->circ_successes, guard->circ_attempts, guard->nickname,
|
guard->circ_successes, guard->circ_attempts, guard->nickname,
|
||||||
hex_str(guard->identity, DIGEST_LEN));
|
hex_str(guard->identity, DIGEST_LEN));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1060,7 +1060,7 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg)
|
|||||||
node->collapsed_circuits = collapsed;
|
node->collapsed_circuits = collapsed;
|
||||||
node->unusable_circuits = unusable;
|
node->unusable_circuits = unusable;
|
||||||
|
|
||||||
log_info(LD_GENERAL, "Read %lf/%lf path bias for node %s",
|
log_info(LD_GENERAL, "Read %f/%f path bias for node %s",
|
||||||
node->circ_successes, node->circ_attempts, node->nickname);
|
node->circ_successes, node->circ_attempts, node->nickname);
|
||||||
/* Note: We rely on the < comparison here to allow us to set a 0
|
/* Note: We rely on the < comparison here to allow us to set a 0
|
||||||
* rate and disable the feature entirely. If refactoring, don't
|
* rate and disable the feature entirely. If refactoring, don't
|
||||||
@ -1070,7 +1070,7 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg)
|
|||||||
pathbias_get_dropguards(options)) {
|
pathbias_get_dropguards(options)) {
|
||||||
node->path_bias_disabled = 1;
|
node->path_bias_disabled = 1;
|
||||||
log_info(LD_GENERAL,
|
log_info(LD_GENERAL,
|
||||||
"Path bias is too high (%lf/%lf); disabling node %s",
|
"Path bias is too high (%f/%f); disabling node %s",
|
||||||
node->circ_successes, node->circ_attempts, node->nickname);
|
node->circ_successes, node->circ_attempts, node->nickname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1200,7 +1200,7 @@ entry_guards_update_state(or_state_t *state)
|
|||||||
/* In the long run: circuit_success ~= successful_circuit_close +
|
/* In the long run: circuit_success ~= successful_circuit_close +
|
||||||
* collapsed_circuits +
|
* collapsed_circuits +
|
||||||
* unusable_circuits */
|
* unusable_circuits */
|
||||||
tor_asprintf(&line->value, "%lf %lf %lf %lf %lf %lf",
|
tor_asprintf(&line->value, "%f %f %f %f %f %f",
|
||||||
e->circ_attempts, e->circ_successes,
|
e->circ_attempts, e->circ_successes,
|
||||||
pathbias_get_closed_count(e), e->collapsed_circuits,
|
pathbias_get_closed_count(e), e->collapsed_circuits,
|
||||||
e->unusable_circuits, e->timeouts);
|
e->unusable_circuits, e->timeouts);
|
||||||
|
Loading…
Reference in New Issue
Block a user