diff options
author | Roger Dingledine <arma@torproject.org> | 2015-01-18 15:39:12 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-01-18 15:39:12 -0500 |
commit | 9407040c592184e05e45a3c1a00739c2dd302288 (patch) | |
tree | d6bd075a8412ce9e78fa3804187f6fc25079be33 /src/or | |
parent | 2329d9fe3739aca46d00b47222db2f78bd23e4d3 (diff) | |
download | tor-9407040c592184e05e45a3c1a00739c2dd302288.tar.gz tor-9407040c592184e05e45a3c1a00739c2dd302288.zip |
Do not replace a HS descriptor with a different replica of itself
This fixes a bug where we'd fetch different replicas of the same
descriptor for a down hidden service over and over, until we got lucky
and fetched the same replica twice in a row.
Fixes bug 14219; bugfix on 0.2.0.10-alpha.
(Patch from Roger; commit message and changes file by Nick.)
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/rendcommon.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index a664b5d501..3d2b706104 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -1146,19 +1146,12 @@ rend_cache_store_v2_desc_as_client(const char *desc, /* Do we already have a newer descriptor? */ tor_snprintf(key, sizeof(key), "2%s", service_id); e = (rend_cache_entry_t*) strmap_get_lc(rend_cache, key); - if (e && e->parsed->timestamp > parsed->timestamp) { - log_info(LD_REND, "We already have a newer service descriptor for " + if (e && e->parsed->timestamp >= parsed->timestamp) { + log_info(LD_REND, "We already have a new enough service descriptor for " "service ID %s with the same desc ID and version.", safe_str_client(service_id)); goto okay; } - /* Do we already have this descriptor? */ - if (e && !strcmp(desc, e->desc)) { - log_info(LD_REND,"We already have this service descriptor %s.", - safe_str_client(service_id)); - e->received = time(NULL); - goto okay; - } if (!e) { e = tor_malloc_zero(sizeof(rend_cache_entry_t)); strmap_set_lc(rend_cache, key, e); |