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

[or-cvs] r14971: make sure, when we're checking if we have enough dir info, t (tor/trunk/src/or)



Author: arma
Date: 2008-06-05 07:37:40 -0400 (Thu, 05 Jun 2008)
New Revision: 14971

Modified:
   tor/trunk/src/or/routerlist.c
Log:
make sure, when we're checking if we have enough dir info, that
we actually have the descriptor listed in the consensus, not just
any descriptor, for each relay.

don't backport this patch (yet); who knows what it might do.


Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2008-06-05 10:57:09 UTC (rev 14970)
+++ tor/trunk/src/or/routerlist.c	2008-06-05 11:37:40 UTC (rev 14971)
@@ -4194,6 +4194,7 @@
   int res;
   or_options_t *options = get_options();
   routerinfo_t *ri;
+  signed_descriptor_t *sd;
   const networkstatus_t *consensus =
     networkstatus_get_reasonably_live_consensus(now);
 
@@ -4220,10 +4221,12 @@
      {
        if (client_would_use_router(rs, now, options)) {
          ++num_usable; /* the consensus says we want it. */
-         /* XXX021 shouldn't we look up by descriptor digest? */
-         ri = router_get_by_digest(rs->identity_digest);
-         if (ri) {
-           ++num_present; /* we have some descriptor for it. */
+         if ((sd = router_get_by_descriptor_digest(rs->descriptor_digest)) &&
+             (ri = router_get_by_digest(rs->identity_digest)) &&
+             !memcmp(ri->cache_info.signed_descriptor_digest,
+                     sd->signed_descriptor_digest, DIGEST_LEN)) {
+           /* we have the descriptor listed in the consensus. */
+           ++num_present;
            if (ri->is_running)
              ++num_running; /* our local status says it's still up. */
          }