From 0a1dd92d3e498ce579944c95d3c82e97863b9ba6 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 11 Oct 2007 16:06:37 +0000 Subject: [PATCH] r14884@Kushana: nickm | 2007-10-11 10:30:58 -0400 More fixes for cacheing bridge descs:Remove obsolete EXTRAINFO_PURPOSE_GENERAL; remove purpose argument from signed_desc_append_to_journal. svn:r11867 --- src/or/or.h | 6 ------ src/or/routerlist.c | 30 +++++++----------------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/src/or/or.h b/src/or/or.h index e849787a78..abb3c15fb7 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1188,12 +1188,6 @@ typedef struct { int routerlist_index; } routerinfo_t; -/** DOCDOC - * XXXX020 remove this; purpose should have the same value for router - * and extrainfo. - */ -#define EXTRAINFO_PURPOSE_GENERAL 0 - /** Information needed to keep and cache a signed extra-info document. */ typedef struct extrainfo_t { signed_descriptor_t cache_info; diff --git a/src/or/routerlist.c b/src/or/routerlist.c index b0914db54e..169e0df8f9 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -410,14 +410,10 @@ router_get_store(routerlist_t *rl, routerinfo_t *ri) /** Add the signed_descriptor_t in desc to the router * journal; change its saved_location to SAVED_IN_JOURNAL and set its - * offset appropriately. - * - * If purpose isn't ROUTER_PURPOSE_GENERAL or - * EXTRAINFO_PURPOSE_GENERAL, just do nothing. */ + * offset appropriately. */ static int signed_desc_append_to_journal(signed_descriptor_t *desc, - desc_store_t *store, - int purpose) // XXXX NM Nuke purpose. + desc_store_t *store) { or_options_t *options = get_options(); size_t fname_len = strlen(options->DataDirectory)+32; @@ -425,13 +421,6 @@ signed_desc_append_to_journal(signed_descriptor_t *desc, const char *body = signed_descriptor_get_body_impl(desc,1); size_t len = desc->signed_descriptor_len + desc->annotations_len; - /* XXXX020 remove this; we can now cache things with weird purposes. */ - if (purpose != ROUTER_PURPOSE_GENERAL && - purpose != EXTRAINFO_PURPOSE_GENERAL) { - /* we shouldn't cache it. be happy and return. */ - return 0; - } - fname = tor_malloc(fname_len); tor_snprintf(fname, fname_len, "%s"PATH_SEPARATOR"%s.new", options->DataDirectory, store->fname_base); @@ -2601,8 +2590,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg, /* Only journal this desc if we'll be serving it. */ if (!from_cache && should_cache_old_descriptors()) signed_desc_append_to_journal(&router->cache_info, - router_get_store(routerlist, router), - router->purpose); + router_get_store(routerlist, router)); routerlist_insert_old(routerlist, router); return -1; } @@ -2631,8 +2619,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg, /* Only journal this desc if we'll be serving it. */ if (!from_cache && should_cache_old_descriptors()) signed_desc_append_to_journal(&router->cache_info, - router_get_store(routerlist, router), - router->purpose); + router_get_store(routerlist, router)); routerlist_insert_old(routerlist, router); *msg = "Router descriptor was not new."; return -1; @@ -2669,8 +2656,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg, routerlist_replace(routerlist, old_router, router); if (!from_cache) { signed_desc_append_to_journal(&router->cache_info, - router_get_store(routerlist, router), - router->purpose); + router_get_store(routerlist, router)); } directory_set_dirty(); *msg = unreachable ? "Dirserver believes your ORPort is unreachable" : @@ -2686,8 +2672,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg, routerlist_insert(routerlist, router); if (!from_cache) signed_desc_append_to_journal(&router->cache_info, - router_get_store(routerlist, router), - router->purpose); + router_get_store(routerlist, router)); directory_set_dirty(); return 0; } @@ -2706,8 +2691,7 @@ router_add_extrainfo_to_routerlist(extrainfo_t *ei, const char **msg, if (inserted && !from_cache) signed_desc_append_to_journal(&ei->cache_info, - &routerlist->extrainfo_store, - EXTRAINFO_PURPOSE_GENERAL); + &routerlist->extrainfo_store); } /** Sorting helper: return <0, 0, or >0 depending on whether the