summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-02 11:32:49 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-02 11:32:49 -0400
commitfbfaa7bbc417d7adc19dc55154a8648fe6412ec6 (patch)
tree656f56397abcd37376aa3f3e8507027275a622db /src
parent4504640b101fbbc88632f7f5efb923b801391052 (diff)
parent9ca311f6220cd52a0f8fcb3bc072cd9569bd1c6e (diff)
downloadtor-fbfaa7bbc417d7adc19dc55154a8648fe6412ec6.tar.gz
tor-fbfaa7bbc417d7adc19dc55154a8648fe6412ec6.zip
Merge commit 'sebastian/bug1776_v2'
Diffstat (limited to 'src')
-rw-r--r--src/or/routerlist.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 5f98abe01b..8808f56db9 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3151,15 +3151,23 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
id_digest = router->cache_info.identity_digest;
+ old_router = router_get_by_digest(id_digest);
+
/* Make sure that we haven't already got this exact descriptor. */
if (sdmap_get(routerlist->desc_digest_map,
router->cache_info.signed_descriptor_digest)) {
- log_info(LD_DIR,
- "Dropping descriptor that we already have for router '%s'",
- router->nickname);
- *msg = "Router descriptor was not new.";
- routerinfo_free(router);
- return ROUTER_WAS_NOT_NEW;
+ /* If we have this descriptor already and the new descriptor is a bridge
+ * descriptor, replace it. If we had a bridge descriptor before and the
+ * new one is not a bridge descriptor, don't replace it. */
+ if (old_router && (!routerinfo_is_a_configured_bridge(router) ||
+ routerinfo_is_a_configured_bridge(old_router))) {
+ log_info(LD_DIR,
+ "Dropping descriptor that we already have for router '%s'",
+ router->nickname);
+ *msg = "Router descriptor was not new.";
+ routerinfo_free(router);
+ return ROUTER_WAS_NOT_NEW;
+ }
}
if (authdir) {
@@ -3196,15 +3204,14 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
SMARTLIST_FOREACH(networkstatus_v2_list, networkstatus_v2_t *, ns,
{
routerstatus_t *rs =
- networkstatus_v2_find_entry(ns, router->cache_info.identity_digest);
+ networkstatus_v2_find_entry(ns, id_digest);
if (rs && !memcmp(rs->descriptor_digest,
router->cache_info.signed_descriptor_digest,
DIGEST_LEN))
rs->need_to_mirror = 0;
});
if (consensus) {
- routerstatus_t *rs = networkstatus_vote_find_entry(consensus,
- router->cache_info.identity_digest);
+ routerstatus_t *rs = networkstatus_vote_find_entry(consensus, id_digest);
if (rs && !memcmp(rs->descriptor_digest,
router->cache_info.signed_descriptor_digest,
DIGEST_LEN)) {
@@ -3226,8 +3233,6 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
}
/* If we have a router with the same identity key, choose the newer one. */
- old_router = rimap_get(routerlist->identity_map,
- router->cache_info.identity_digest);
if (old_router) {
if (!in_consensus && (router->cache_info.published_on <=
old_router->cache_info.published_on)) {