mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
Actually count exits with conflux support, rather than relays.
This commit is contained in:
parent
2bb8988629
commit
61aa4c3657
@ -100,19 +100,28 @@ static void
|
|||||||
count_exit_with_conflux_support(const networkstatus_t *ns)
|
count_exit_with_conflux_support(const networkstatus_t *ns)
|
||||||
{
|
{
|
||||||
double supported = 0.0;
|
double supported = 0.0;
|
||||||
|
int total_exits = 0;
|
||||||
|
|
||||||
if (!ns || smartlist_len(ns->routerstatus_list) == 0) {
|
if (!ns || smartlist_len(ns->routerstatus_list) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMARTLIST_FOREACH_BEGIN(ns->routerstatus_list, const routerstatus_t *, rs) {
|
SMARTLIST_FOREACH_BEGIN(ns->routerstatus_list, const routerstatus_t *, rs) {
|
||||||
|
if (!rs->is_exit || rs->is_bad_exit) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (rs->pv.supports_conflux) {
|
if (rs->pv.supports_conflux) {
|
||||||
supported++;
|
supported++;
|
||||||
}
|
}
|
||||||
|
total_exits++;
|
||||||
} SMARTLIST_FOREACH_END(rs);
|
} SMARTLIST_FOREACH_END(rs);
|
||||||
|
|
||||||
|
if (total_exits > 0) {
|
||||||
exit_conflux_ratio =
|
exit_conflux_ratio =
|
||||||
supported / smartlist_len(ns->routerstatus_list);
|
supported / total_exits;
|
||||||
|
} else {
|
||||||
|
exit_conflux_ratio = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
log_info(LD_GENERAL, "Consensus has %.2f %% Exit relays supporting Conflux",
|
log_info(LD_GENERAL, "Consensus has %.2f %% Exit relays supporting Conflux",
|
||||||
exit_conflux_ratio * 100.0);
|
exit_conflux_ratio * 100.0);
|
||||||
|
Loading…
Reference in New Issue
Block a user