Kaynağa Gözat

stop being so eager to have rend_cache_store reject the
service descriptor


svn:r1566

Roger Dingledine 20 yıl önce
ebeveyn
işleme
4122e2de11
1 değiştirilmiş dosya ile 6 ekleme ve 5 silme
  1. 6 5
      src/or/rendcommon.c

+ 6 - 5
src/or/rendcommon.c

@@ -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));