diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-10-12 18:25:25 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-10-12 18:25:25 +0000 |
commit | 972b7512c7e90aca3ba73333c8fa32cfb9974571 (patch) | |
tree | 54b3e8b4bf57801c8f14c49fdab13b4b3b43e1e8 /src/or/dirserv.c | |
parent | fd9bfef13bb68c38adb9bb7017c8bbf73d3bfb2c (diff) | |
download | tor-972b7512c7e90aca3ba73333c8fa32cfb9974571.tar.gz tor-972b7512c7e90aca3ba73333c8fa32cfb9974571.zip |
authorities do not replace server descriptors where nothing semantically relevant has changed since the last upload.
svn:r5240
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 44ed8c31e7..23f4d952cb 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -439,7 +439,7 @@ int dirserv_add_descriptor(const char *desc, const char **msg) { int r; - routerinfo_t *ri = NULL; + routerinfo_t *ri = NULL, *ri_old = NULL; tor_assert(msg); *msg = NULL; @@ -450,6 +450,19 @@ dirserv_add_descriptor(const char *desc, const char **msg) *msg = "Rejected: Couldn't parse server descriptor."; return -2; } + /* Check whether this descriptor is semantically identical to the last one + * from this server. (We do this here and not in router_add_to_routerlist + * because we want to be able to accept the newest router descriptor that + * another authority has, so we all converge on the same one.) */ + ri_old = router_get_by_digest(ri->identity_digest); + if (ri_old && ri_old->published_on < ri->published_on && + router_differences_are_cosmetic(ri_old, ri)) { + log_fn(LOG_INFO, + "Not replacing descriptor from '%s'; differences are cosmetic.", + ri->nickname); + *msg = "Not replacing router descriptor; no information has changed since the last one with this identity."; + return 0; + } if ((r = router_add_to_routerlist(ri, msg, 0))<0) { return r == -1 ? 0 : -1; } else { |