aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-10-13 14:11:27 -0400
committerNick Mathewson <nickm@torproject.org>2014-10-13 14:31:11 -0400
commit223d354e344ad3d07766b7c19e1841342c270ad2 (patch)
treeab2026149aec399fe4ff9a1e8a9d97228f1afa88 /src/or/routerlist.h
parent39795e117f55fc951ea9ba0802ce5ce91e65ae33 (diff)
downloadtor-223d354e344ad3d07766b7c19e1841342c270ad2.tar.gz
tor-223d354e344ad3d07766b7c19e1841342c270ad2.zip
Bugfixes on bug11243 fix for the not-added cases and tests
1. The test that adds things to the cache needs to set the clock back so that the descriptors it adds are valid. 2. We split ROUTER_NOT_NEW into ROUTER_TOO_OLD, so that we can distinguish "already had it" from "rejected because of old published date". 3. We make extrainfo_insert() return a was_router_added_t, and we make its caller use it correctly. This is probably redundant with the extrainfo_is_bogus flag.
Diffstat (limited to 'src/or/routerlist.h')
-rw-r--r--src/or/routerlist.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/or/routerlist.h b/src/or/routerlist.h
index 950320aa14..a0f43d430c 100644
--- a/src/or/routerlist.h
+++ b/src/or/routerlist.h
@@ -100,6 +100,7 @@ void routerlist_reset_warnings(void);
static int WRA_WAS_ADDED(was_router_added_t s);
static int WRA_WAS_OUTDATED(was_router_added_t s);
static int WRA_WAS_REJECTED(was_router_added_t s);
+static int WRA_NEVER_DOWNLOADABLE(was_router_added_t s);
/** Return true iff the outcome code in <b>s</b> indicates that the descriptor
* was added. It might still be necessary to check whether the descriptor
* generator should be notified.
@@ -116,7 +117,8 @@ WRA_WAS_ADDED(was_router_added_t s) {
*/
static INLINE int WRA_WAS_OUTDATED(was_router_added_t s)
{
- return (s == ROUTER_WAS_NOT_NEW ||
+ return (s == ROUTER_WAS_TOO_OLD ||
+ s == ROUTER_WAS_NOT_NEW ||
s == ROUTER_NOT_IN_CONSENSUS ||
s == ROUTER_NOT_IN_CONSENSUS_OR_NETWORKSTATUS);
}
@@ -126,6 +128,14 @@ static INLINE int WRA_WAS_REJECTED(was_router_added_t s)
{
return (s == ROUTER_AUTHDIR_REJECTS);
}
+/** Return true iff the outcome code in <b>s</b> indicates that the descriptor
+ * was flat-out rejected. */
+static INLINE int WRA_NEVER_DOWNLOADABLE(was_router_added_t s)
+{
+ return (s == ROUTER_AUTHDIR_REJECTS ||
+ s == ROUTER_BAD_EI ||
+ s == ROUTER_WAS_TOO_OLD);
+}
was_router_added_t router_add_to_routerlist(routerinfo_t *router,
const char **msg,
int from_cache,
@@ -216,7 +226,8 @@ STATIC void scale_array_elements_to_u64(u64_dbl_t *entries, int n_entries,
MOCK_DECL(int, router_descriptor_is_older_than, (const routerinfo_t *router,
int seconds));
-MOCK_DECL(STATIC int, extrainfo_insert,(routerlist_t *rl, extrainfo_t *ei));
+MOCK_DECL(STATIC was_router_added_t, extrainfo_insert,
+ (routerlist_t *rl, extrainfo_t *ei));
#endif