mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
clean up comments and whitespace a bit
This commit is contained in:
parent
b401ccefd7
commit
0e4bdc4005
@ -1060,7 +1060,8 @@ update_total_bandwidth_weights(const routerstatus_t *rs,
|
|||||||
* E' = E + (1-F)*B, if N has the exit flag
|
* E' = E + (1-F)*B, if N has the exit flag
|
||||||
*
|
*
|
||||||
* In this block of code, we prepare the bandwidth values by setting
|
* In this block of code, we prepare the bandwidth values by setting
|
||||||
* the default_bandwidth to F*B and guardfraction_bandwidth to (1-F)*B. */
|
* the default_bandwidth to F*B and guardfraction_bandwidth to (1-F)*B.
|
||||||
|
*/
|
||||||
if (rs->has_guardfraction) {
|
if (rs->has_guardfraction) {
|
||||||
guardfraction_bandwidth_t guardfraction_bw;
|
guardfraction_bandwidth_t guardfraction_bw;
|
||||||
|
|
||||||
@ -1075,10 +1076,11 @@ update_total_bandwidth_weights(const routerstatus_t *rs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now calculate the total bandwidth weights with or without
|
/* Now calculate the total bandwidth weights with or without
|
||||||
guardfraction. Depending on the flags of the relay, add its
|
* guardfraction. Depending on the flags of the relay, add its
|
||||||
bandwidth to the appropriate weight pool. If it's a guard and
|
* bandwidth to the appropriate weight pool. If it's a guard and
|
||||||
guardfraction is enabled, add its bandwidth to both pools as
|
* guardfraction is enabled, add its bandwidth to both pools as
|
||||||
indicated by the previous comment. */
|
* indicated by the previous comment.
|
||||||
|
*/
|
||||||
*T += default_bandwidth;
|
*T += default_bandwidth;
|
||||||
if (is_exit && is_guard) {
|
if (is_exit && is_guard) {
|
||||||
|
|
||||||
|
@ -161,11 +161,11 @@ double pathbias_get_close_success_count(entry_guard_t *guard);
|
|||||||
double pathbias_get_use_success_count(entry_guard_t *guard);
|
double pathbias_get_use_success_count(entry_guard_t *guard);
|
||||||
|
|
||||||
/** Contains the bandwidth of a relay as a guard and as a non-guard
|
/** Contains the bandwidth of a relay as a guard and as a non-guard
|
||||||
* after the guardfraction has been considered. */
|
* after the guardfraction has been considered. */
|
||||||
typedef struct guardfraction_bandwidth_t {
|
typedef struct guardfraction_bandwidth_t {
|
||||||
/* Bandwidth as a guard after guardfraction has been considered. */
|
/** Bandwidth as a guard after guardfraction has been considered. */
|
||||||
int guard_bw;
|
int guard_bw;
|
||||||
/* Bandwidth as a non-guard after guardfraction has been considered. */
|
/** Bandwidth as a non-guard after guardfraction has been considered. */
|
||||||
int non_guard_bw;
|
int non_guard_bw;
|
||||||
} guardfraction_bandwidth_t;
|
} guardfraction_bandwidth_t;
|
||||||
|
|
||||||
|
@ -1827,7 +1827,7 @@ routerstatus_parse_guardfraction(const char *guardfraction_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
guardfraction = (uint32_t)tor_parse_ulong(end_of_header+1,
|
guardfraction = (uint32_t)tor_parse_ulong(end_of_header+1,
|
||||||
10, 0, 100, &ok, NULL);
|
10, 0, 100, &ok, NULL);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
log_warn(LD_DIR, "Invalid GuardFraction %s", escaped(guardfraction_str));
|
log_warn(LD_DIR, "Invalid GuardFraction %s", escaped(guardfraction_str));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "test_helpers.h"
|
#include "test_helpers.h"
|
||||||
|
|
||||||
/* Generate a vote_routerstatus_t for a router with identity digest
|
/** Generate a vote_routerstatus_t for a router with identity digest
|
||||||
<b>digest_in_hex</b>. */
|
* <b>digest_in_hex</b>. */
|
||||||
static vote_routerstatus_t *
|
static vote_routerstatus_t *
|
||||||
gen_vote_routerstatus_for_tests(const char *digest_in_hex, int is_guard)
|
gen_vote_routerstatus_for_tests(const char *digest_in_hex, int is_guard)
|
||||||
{
|
{
|
||||||
@ -169,7 +169,7 @@ test_parse_guardfraction_file_bad(void *arg)
|
|||||||
tor_free(guardfraction_bad);
|
tor_free(guardfraction_bad);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that our test guardfraction file gets parsed properly, and
|
/** Make sure that our test guardfraction file gets parsed properly, and
|
||||||
* its information are applied properly to our routerstatuses. */
|
* its information are applied properly to our routerstatuses. */
|
||||||
static void
|
static void
|
||||||
test_parse_guardfraction_file_good(void *arg)
|
test_parse_guardfraction_file_good(void *arg)
|
||||||
@ -263,7 +263,7 @@ test_get_guardfraction_bandwidth(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Parse the GuardFraction element of the consensus, and make sure it
|
/** Parse the GuardFraction element of the consensus, and make sure it
|
||||||
* gets parsed correctly. */
|
* gets parsed correctly. */
|
||||||
static void
|
static void
|
||||||
test_parse_guardfraction_consensus(void *arg)
|
test_parse_guardfraction_consensus(void *arg)
|
||||||
{
|
{
|
||||||
@ -337,8 +337,8 @@ test_parse_guardfraction_consensus(void *arg)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that we use GuardFraction information when we should,
|
/** Make sure that we use GuardFraction information when we should,
|
||||||
according to the torrc option and consensus parameter. */
|
* according to the torrc option and consensus parameter. */
|
||||||
static void
|
static void
|
||||||
test_should_apply_guardfraction(void *arg)
|
test_should_apply_guardfraction(void *arg)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user