[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r14245: oops; fix bug in descriptor metric logic. (in tor/trunk: . src/or)



Author: nickm
Date: 2008-03-30 11:59:32 -0400 (Sun, 30 Mar 2008)
New Revision: 14245

Modified:
   tor/trunk/
   tor/trunk/src/or/routerlist.c
Log:
 r19138@catbus:  nickm | 2008-03-30 11:59:26 -0400
 oops; fix bug in descriptor metric logic.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r19138] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2008-03-30 14:55:24 UTC (rev 14244)
+++ tor/trunk/src/or/routerlist.c	2008-03-30 15:59:32 UTC (rev 14245)
@@ -2265,17 +2265,25 @@
         char last_valid_until[ISO_TIME_LEN+1];
         char last_served_at[ISO_TIME_LEN+1];
         char id[HEX_DIGEST_LEN+1];
+        routerstatus_t *rs;
         format_iso_time(published, sd->published_on);
         format_iso_time(last_valid_until, sd->last_listed_as_valid_until);
         format_iso_time(last_served_at, sd->last_served_at);
         base16_encode(id, sizeof(id), sd->identity_digest, DIGEST_LEN);
         SMARTLIST_FOREACH(networkstatus_v2_list, networkstatus_v2_t *, ns,
-          if (networkstatus_v2_find_entry(ns, sd->identity_digest)) {
-            in_v2 = 1; break;
+          {
+            rs = networkstatus_v2_find_entry(ns, sd->identity_digest);
+            if (rs && !memcmp(rs->descriptor_digest,
+                              sd->signed_descriptor_digest, DIGEST_LEN)) {
+              in_v2 = 1; break;
+            }
           });
-        if (consensus && networkstatus_vote_find_entry(consensus,
-                                                       sd->identity_digest))
-          in_v3 = 1;
+        if (consensus) {
+          rs = networkstatus_vote_find_entry(consensus, sd->identity_digest);
+          if (rs && !memcmp(rs->descriptor_digest,
+                            sd->signed_descriptor_digest, DIGEST_LEN))
+            in_v3 = 1;
+        }
         log(severity, LD_DIR,
             "Old descriptor for %s (published %s) %sin v2 ns, %sin v3 "
             "consensus.  Last valid until %s; last served at %s.",