stop being so eager to have rend_cache_store reject the

service descriptor


svn:r1566
This commit is contained in:
Roger Dingledine 2004-04-08 05:08:27 +00:00
parent bb46d782ab
commit 4122e2de11

View File

@ -213,7 +213,8 @@ int rend_cache_lookup_desc(char *query, const char **desc, int *desc_len)
/* Calculate desc's service id, and store it.
* Return -1 if it's malformed or otherwise rejected, else return 0.
* Return -1 if it's malformed or otherwise rejected and you
* want the caller to fail, else return 0.
*/
int rend_cache_store(char *desc, int desc_len)
{
@ -245,15 +246,15 @@ int rend_cache_store(char *desc, int desc_len)
}
e = (rend_cache_entry_t*) strmap_get_lc(rend_cache, query);
if (e && e->parsed->timestamp > parsed->timestamp) {
log_fn(LOG_WARN,"We already have a newer service descriptor with the same ID");
log_fn(LOG_INFO,"We already have a newer service descriptor with the same ID");
rend_service_descriptor_free(parsed);
return -1;
return 0;
}
if (e && e->len == desc_len && !memcmp(desc,e->desc,desc_len)) {
log_fn(LOG_WARN,"We already have this service descriptor");
log_fn(LOG_INFO,"We already have this service descriptor");
e->received = time(NULL);
rend_service_descriptor_free(parsed);
return -1;
return 0;
}
if (!e) {
e = tor_malloc_zero(sizeof(rend_cache_entry_t));