diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-04-08 05:43:52 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-04-08 05:43:52 +0000 |
commit | 5d466b76112ab5eaf59d9da4690f230abc9b2f44 (patch) | |
tree | e648d6812fe992df7378086741e09c6fe7abc61b | |
parent | 7a804572ab18c4de0e576e521d583a5fa07808ac (diff) | |
download | tor-5d466b76112ab5eaf59d9da4690f230abc9b2f44.tar.gz tor-5d466b76112ab5eaf59d9da4690f230abc9b2f44.zip |
Fix a couple of things that make GCC complain with verbose warnings on. Also, fix some whitespace.
svn:r6317
-rw-r--r-- | src/or/config.c | 2 | ||||
-rw-r--r-- | src/or/dirserv.c | 10 | ||||
-rw-r--r-- | src/or/or.h | 1 | ||||
-rw-r--r-- | src/or/policies.c | 4 |
4 files changed, 11 insertions, 6 deletions
diff --git a/src/or/config.c b/src/or/config.c index a1fc6b434f..1d7bd65954 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -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, * 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. - * + * * If not success, point *<b>msg</b> to a newly allocated string describing * what went wrong. */ diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 43fa17df15..0166c95b91 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1192,6 +1192,12 @@ static uint32_t stable_uptime = 0; /* start at a safe value */ static uint32_t fast_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. * 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 @@ -1203,7 +1209,7 @@ dirserv_thinks_router_is_unreliable(time_t now, int need_uptime, int need_capacity) { if (need_uptime && - router->uptime+(now - router->cache_info.published_on) < stable_uptime) + (unsigned)real_uptime(router, now) < stable_uptime) return 1; if (need_capacity && 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) { uint32_t *up = 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); *bw = router_get_advertised_bandwidth(ri); smartlist_add(bandwidths, bw); diff --git a/src/or/or.h b/src/or/or.h index 3ed8e6cd4f..0310acade1 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1621,7 +1621,6 @@ int resolve_my_address(or_options_t *options, uint32_t *addr, void options_init(or_options_t *options); int options_init_from_torrc(int argc, char **argv); 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); const char *option_get_canonical_name(const char *key); config_line_t *option_get_assignment(or_options_t *options, diff --git a/src/or/policies.c b/src/or/policies.c index dba6f2678f..32c3fbc72f 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -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->DirPolicy, &dir_policy, -1); @@ -273,7 +274,6 @@ void policies_parse_from_options(or_options_t *options) parse_reachable_addresses(); } - /** 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. */ static int |