mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Fix a couple of things that make GCC complain with verbose warnings on. Also, fix some whitespace.
svn:r6317
This commit is contained in:
parent
7a804572ab
commit
5d466b7611
@ -1441,7 +1441,7 @@ config_assign(config_format_t *fmt, void *options, config_line_t *list,
|
|||||||
* ok, then throw out the old one and stick with the new one. Else,
|
* ok, then throw out the old one and stick with the new one. Else,
|
||||||
* revert to old and return failure. Return 0 on success, -1 on bad
|
* revert to old and return failure. Return 0 on success, -1 on bad
|
||||||
* keys, -2 on bad values, -3 on bad transition, and -4 on failed-to-set.
|
* keys, -2 on bad values, -3 on bad transition, and -4 on failed-to-set.
|
||||||
*
|
*
|
||||||
* If not success, point *<b>msg</b> to a newly allocated string describing
|
* If not success, point *<b>msg</b> to a newly allocated string describing
|
||||||
* what went wrong.
|
* what went wrong.
|
||||||
*/
|
*/
|
||||||
|
@ -1192,6 +1192,12 @@ static uint32_t stable_uptime = 0; /* start at a safe value */
|
|||||||
static uint32_t fast_bandwidth = 0;
|
static uint32_t fast_bandwidth = 0;
|
||||||
static uint32_t guard_bandwidth = 0;
|
static uint32_t guard_bandwidth = 0;
|
||||||
|
|
||||||
|
static INLINE int
|
||||||
|
real_uptime(routerinfo_t *router, time_t now)
|
||||||
|
{
|
||||||
|
return router->uptime + (now - router->cache_info.published_on);
|
||||||
|
}
|
||||||
|
|
||||||
/** Return 1 if <b>router</b> is not suitable for these parameters, else 0.
|
/** Return 1 if <b>router</b> is not suitable for these parameters, else 0.
|
||||||
* If <b>need_uptime</b> is non-zero, we require a minimum uptime.
|
* If <b>need_uptime</b> is non-zero, we require a minimum uptime.
|
||||||
* If <b>need_capacity</b> is non-zero, we require a minimum advertised
|
* If <b>need_capacity</b> is non-zero, we require a minimum advertised
|
||||||
@ -1203,7 +1209,7 @@ dirserv_thinks_router_is_unreliable(time_t now,
|
|||||||
int need_uptime, int need_capacity)
|
int need_uptime, int need_capacity)
|
||||||
{
|
{
|
||||||
if (need_uptime &&
|
if (need_uptime &&
|
||||||
router->uptime+(now - router->cache_info.published_on) < stable_uptime)
|
(unsigned)real_uptime(router, now) < stable_uptime)
|
||||||
return 1;
|
return 1;
|
||||||
if (need_capacity &&
|
if (need_capacity &&
|
||||||
router_get_advertised_bandwidth(router) < fast_bandwidth)
|
router_get_advertised_bandwidth(router) < fast_bandwidth)
|
||||||
@ -1236,7 +1242,7 @@ dirserv_compute_performance_thresholds(routerlist_t *rl)
|
|||||||
if (ri->is_running && ri->is_valid) {
|
if (ri->is_running && ri->is_valid) {
|
||||||
uint32_t *up = tor_malloc(sizeof(uint32_t));
|
uint32_t *up = tor_malloc(sizeof(uint32_t));
|
||||||
uint32_t *bw = tor_malloc(sizeof(uint32_t));
|
uint32_t *bw = tor_malloc(sizeof(uint32_t));
|
||||||
*up = (uint32_t) ri->uptime + (now - ri->cache_info.published_on);
|
*up = (uint32_t) real_uptime(ri, now);
|
||||||
smartlist_add(uptimes, up);
|
smartlist_add(uptimes, up);
|
||||||
*bw = router_get_advertised_bandwidth(ri);
|
*bw = router_get_advertised_bandwidth(ri);
|
||||||
smartlist_add(bandwidths, bw);
|
smartlist_add(bandwidths, bw);
|
||||||
|
@ -1621,7 +1621,6 @@ int resolve_my_address(or_options_t *options, uint32_t *addr,
|
|||||||
void options_init(or_options_t *options);
|
void options_init(or_options_t *options);
|
||||||
int options_init_from_torrc(int argc, char **argv);
|
int options_init_from_torrc(int argc, char **argv);
|
||||||
int options_init_logs(or_options_t *options, int validate_only);
|
int options_init_logs(or_options_t *options, int validate_only);
|
||||||
void addr_policy_free(addr_policy_t *p);
|
|
||||||
int option_is_recognized(const char *key);
|
int option_is_recognized(const char *key);
|
||||||
const char *option_get_canonical_name(const char *key);
|
const char *option_get_canonical_name(const char *key);
|
||||||
config_line_t *option_get_assignment(or_options_t *options,
|
config_line_t *option_get_assignment(or_options_t *options,
|
||||||
|
@ -262,7 +262,8 @@ load_policy_from_option(config_line_t *config, addr_policy_t **policy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void policies_parse_from_options(or_options_t *options)
|
void
|
||||||
|
policies_parse_from_options(or_options_t *options)
|
||||||
{
|
{
|
||||||
load_policy_from_option(options->SocksPolicy, &socks_policy, -1);
|
load_policy_from_option(options->SocksPolicy, &socks_policy, -1);
|
||||||
load_policy_from_option(options->DirPolicy, &dir_policy, -1);
|
load_policy_from_option(options->DirPolicy, &dir_policy, -1);
|
||||||
@ -273,7 +274,6 @@ void policies_parse_from_options(or_options_t *options)
|
|||||||
parse_reachable_addresses();
|
parse_reachable_addresses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Compare two provided address policy items, and return -1, 0, or 1
|
/** Compare two provided address policy items, and return -1, 0, or 1
|
||||||
* if the first is less than, equal to, or greater than the second. */
|
* if the first is less than, equal to, or greater than the second. */
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user