diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-10-25 19:25:53 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-10-25 20:22:52 +0300 |
commit | 8c8d3b90f767076508944f4eb355180e14b6189e (patch) | |
tree | 9c031adf7333fc73bd2ffcf002a42965e646bf9e /src/or | |
parent | c7a1a987d6dfcb65a5fd639cc3d37b76809c37d5 (diff) | |
download | tor-8c8d3b90f767076508944f4eb355180e14b6189e.tar.gz tor-8c8d3b90f767076508944f4eb355180e14b6189e.zip |
Add a unittest that reveals the offending case of #23862.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/directory.c | 4 | ||||
-rw-r--r-- | src/or/directory.h | 3 | ||||
-rw-r--r-- | src/or/entrynodes.c | 6 | ||||
-rw-r--r-- | src/or/entrynodes.h | 4 | ||||
-rw-r--r-- | src/or/networkstatus.c | 2 |
5 files changed, 12 insertions, 7 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 6470723cd8..272b324dbe 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2237,8 +2237,6 @@ load_downloaded_routers(const char *body, smartlist_t *which, return added; } -static int handle_response_fetch_consensus(dir_connection_t *, - const response_handler_args_t *); static int handle_response_fetch_certificate(dir_connection_t *, const response_handler_args_t *); static int handle_response_fetch_status_vote(dir_connection_t *, @@ -2585,7 +2583,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) * consensus document by checking the consensus, storing it, and marking * router requests as reachable. **/ -static int +STATIC int handle_response_fetch_consensus(dir_connection_t *conn, const response_handler_args_t *args) { diff --git a/src/or/directory.h b/src/or/directory.h index 79984be32d..764f0092e0 100644 --- a/src/or/directory.h +++ b/src/or/directory.h @@ -194,6 +194,9 @@ STATIC void warn_disallowed_anonymous_compression_method(compress_method_t); STATIC int handle_response_fetch_hsdesc_v3(dir_connection_t *conn, const response_handler_args_t *args); +STATIC int handle_response_fetch_consensus(dir_connection_t *conn, + const response_handler_args_t *args); + #endif /* defined(DIRECTORY_PRIVATE) */ #ifdef TOR_UNIT_TESTS diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 9fbf426433..76a8f591b9 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -2126,9 +2126,9 @@ circuit_guard_state_free(circuit_guard_state_t *state) /** Allocate and return a new circuit_guard_state_t to track the result * of using <b>guard</b> for a given operation. */ -static circuit_guard_state_t * -circuit_guard_state_new(entry_guard_t *guard, unsigned state, - entry_guard_restriction_t *rst) +MOCK_IMPL(STATIC circuit_guard_state_t *, +circuit_guard_state_new,(entry_guard_t *guard, unsigned state, + entry_guard_restriction_t *rst)) { circuit_guard_state_t *result; diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h index 9e1e729930..86f0517df2 100644 --- a/src/or/entrynodes.h +++ b/src/or/entrynodes.h @@ -488,6 +488,10 @@ STATIC entry_guard_t *get_sampled_guard_with_id(guard_selection_t *gs, MOCK_DECL(STATIC time_t, randomize_time, (time_t now, time_t max_backdate)); +MOCK_DECL(STATIC circuit_guard_state_t *, + circuit_guard_state_new,(entry_guard_t *guard, unsigned state, + entry_guard_restriction_t *rst)); + STATIC entry_guard_t *entry_guard_add_to_sample(guard_selection_t *gs, const node_t *node); STATIC entry_guard_t *entry_guards_expand_sample(guard_selection_t *gs); diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 3a4f06fb7b..abcd4d8658 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1720,7 +1720,7 @@ networkstatus_set_current_consensus(const char *consensus, { networkstatus_t *c=NULL; int r, result = -1; - time_t now = time(NULL); + time_t now = approx_time(); const or_options_t *options = get_options(); char *unverified_fname = NULL, *consensus_fname = NULL; int flav = networkstatus_parse_flavor_name(flavor); |