int *named_flag; /* Index of the flag "Named" for votes[j] */
int *unnamed_flag; /* Index of the flag "Unnamed" for votes[j] */
int chosen_named_idx;
+ int n_authorities_measuring_bandwidth;
strmap_t *name_to_id_map = strmap_new();
char conflict[DIGEST_LEN];
} SMARTLIST_FOREACH_END(v);
}
+ /* We need to know how many votes measure bandwidth. */
+ n_authorities_measuring_bandwidth = 0;
+ SMARTLIST_FOREACH(votes, networkstatus_t *, v,
+ if (v->has_measured_bws) {
+ ++n_authorities_measuring_bandwidth;
+ }
+ );
+
/* Now go through all the votes */
flag_counts = tor_malloc(sizeof(int) * smartlist_len(flags));
while (1) {
/* Pick a bandwidth */
if (consensus_method >= 6 && num_mbws > 2) {
rs_out.has_bandwidth = 1;
+ rs_out.has_measured_bw = 1;
rs_out.bandwidth = median_uint32(measured_bws, num_mbws);
} else if (consensus_method >= 5 && num_bandwidths > 0) {
rs_out.has_bandwidth = 1;
rs_out.bandwidth = median_uint32(bandwidths, num_bandwidths);
- if (consensus_method >= MIN_METHOD_TO_CLIP_UNMEASURED_BW) {
- /* Cap non-measured bandwidths to 20k. */
- if (rs_out.bandwidth > max_unmeasured_bw)
+ if (consensus_method >= MIN_METHOD_TO_CLIP_UNMEASURED_BW &&
+ n_authorities_measuring_bandwidth > 2) {
+ /* Cap non-measured bandwidths. */
+ if (rs_out.bandwidth > max_unmeasured_bw) {
rs_out.bandwidth = max_unmeasured_bw;
+ }
}
}
smartlist_add(chunks, tor_strdup("\n"));
/* Now the weight line. */
if (rs_out.has_bandwidth) {
- smartlist_add_asprintf(chunks, "w Bandwidth=%d\n", rs_out.bandwidth);
+ int unmeasured = ! rs_out.has_measured_bw &&
+ consensus_method >= MIN_METHOD_TO_CLIP_UNMEASURED_BW;
+ smartlist_add_asprintf(chunks, "w Bandwidth=%d%s\n", rs_out.bandwidth,
+ unmeasured?" Unmeasured=1":"");
}
/* Now the exitpolicy summary line. */
typedef struct networkstatus_t {
ENUM_BF(networkstatus_type_t) type : 8; /**< Vote, consensus, or opinion? */
ENUM_BF(consensus_flavor_t) flavor : 8; /**< If a consensus, what kind? */
+ unsigned int has_measured_bws : 1;/**< True iff this networkstatus contains
+ * measured= bandwidth values. */
+
time_t published; /**< Vote only: Time when vote was written. */
time_t valid_after; /**< Time after which this vote or consensus applies. */
time_t fresh_until; /**< Time before which this is the most recent vote or