mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
Small refactoring: explain G,M,E,D,T initialization
This commit is contained in:
parent
6629c5c3fe
commit
77d14b5f56
1 changed files with 6 additions and 1 deletions
|
@ -1335,7 +1335,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
||||||
smartlist_t *flags;
|
smartlist_t *flags;
|
||||||
const char *flavor_name;
|
const char *flavor_name;
|
||||||
uint32_t max_unmeasured_bw_kb = DEFAULT_MAX_UNMEASURED_BW_KB;
|
uint32_t max_unmeasured_bw_kb = DEFAULT_MAX_UNMEASURED_BW_KB;
|
||||||
int64_t G=0, M=0, E=0, D=0, T=0; /* For bandwidth weights */
|
int64_t G, M, E, D, T; /* For bandwidth weights */
|
||||||
const routerstatus_format_type_t rs_format =
|
const routerstatus_format_type_t rs_format =
|
||||||
flavor == FLAV_NS ? NS_V3_CONSENSUS : NS_V3_CONSENSUS_MICRODESC;
|
flavor == FLAV_NS ? NS_V3_CONSENSUS : NS_V3_CONSENSUS_MICRODESC;
|
||||||
char *params = NULL;
|
char *params = NULL;
|
||||||
|
@ -1368,8 +1368,13 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consensus_method >= MIN_METHOD_FOR_INIT_BW_WEIGHTS_ONE) {
|
if (consensus_method >= MIN_METHOD_FOR_INIT_BW_WEIGHTS_ONE) {
|
||||||
|
/* It's smarter to initialize these weights to 1, so that later on,
|
||||||
|
* we can't accidentally divide by zero. */
|
||||||
G = M = E = D = 1;
|
G = M = E = D = 1;
|
||||||
T = 4;
|
T = 4;
|
||||||
|
} else {
|
||||||
|
/* ...but originally, they were set to zero. */
|
||||||
|
G = M = E = D = T = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute medians of time-related things, and figure out how many
|
/* Compute medians of time-related things, and figure out how many
|
||||||
|
|
Loading…
Add table
Reference in a new issue