aboutsummaryrefslogtreecommitdiff
path: root/src/or/microdesc.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-09-28 13:29:31 -0400
committerNick Mathewson <nickm@torproject.org>2010-10-01 18:14:26 -0400
commitfe309e7ad633bee36e175e600f0b9a0ac18cf981 (patch)
tree5e4bc848a6c65ec4eb91f8994ab9980a5ec20fb0 /src/or/microdesc.c
parent80b515b85fdfbcd645cb1920e398b3f2f6e85a31 (diff)
downloadtor-fe309e7ad633bee36e175e600f0b9a0ac18cf981.tar.gz
tor-fe309e7ad633bee36e175e600f0b9a0ac18cf981.zip
Implement a basic node and nodelist type
The node_t type is meant to serve two key functions: 1) Abstracting difference between routerinfo_t and microdesc_t so that clients can use microdesc_t instead of routerinfo_t. 2) Being a central place to hold mutable state about nodes formerly held in routerstatus_t and routerinfo_t. This patch implements a nodelist type that holds a node for every router that we would consider using.
Diffstat (limited to 'src/or/microdesc.c')
-rw-r--r--src/or/microdesc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index 2752d15c8c..19970aa783 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -5,6 +5,7 @@
#include "config.h"
#include "directory.h"
#include "microdesc.h"
+#include "nodelist.h"
#include "routerparse.h"
#include "networkstatus.h"
#include "routerlist.h"
@@ -249,6 +250,12 @@ microdescs_add_list_to_cache(microdesc_cache_t *cache,
microdesc_cache_rebuild(cache);
}
+ {
+ networkstatus_t *ns = networkstatus_get_latest_consensus();
+ if (ns && ns->flavor == FLAV_MICRODESC)
+ SMARTLIST_FOREACH(added, microdesc_t *, md, nodelist_add_microdesc(md));
+ }
+
return added;
}