Kaynağa Gözat

r16471@catbus: nickm | 2007-11-06 15:50:42 -0500
Detect whether any of the descriptors we want are in old_routers. Possibly useful in tracking down bug 543.


svn:r12404

Nick Mathewson 16 yıl önce
ebeveyn
işleme
bc4cefcd7e
2 değiştirilmiş dosya ile 14 ekleme ve 5 silme
  1. 1 0
      doc/TODO
  2. 13 5
      src/or/routerlist.c

+ 1 - 0
doc/TODO

@@ -60,6 +60,7 @@ Things we'd like to do in 0.2.0.x:
         o After we send NETINFO, send CERT and LINK_AUTH if needed.
         - Once we get a good LINK_AUTH, the connection is OPEN.
         - Ban most cell types on a non-OPEN connection.
+        - Close connections on handshake failure.
       o Make code work right wrt TLS context rotation.
       - NETINFO fallout
         - Don't extend a circuit over a noncanonical connection with

+ 13 - 5
src/or/routerlist.c

@@ -3710,7 +3710,7 @@ update_consensus_router_descriptor_downloads(time_t now)
   networkstatus_vote_t *consensus =
     networkstatus_get_reasonably_live_consensus(now);
   int n_delayed=0, n_have=0, n_would_reject=0, n_wouldnt_use=0,
-    n_inprogress=0;
+    n_inprogress=0, n_in_oldrouters=0;
 
   if (!dirserver) {
     if (rep_hist_circbuilding_dormant(now))
@@ -3723,8 +3723,15 @@ update_consensus_router_descriptor_downloads(time_t now)
   list_pending_descriptor_downloads(map, 0);
   SMARTLIST_FOREACH(consensus->routerstatus_list, routerstatus_t *, rs,
     {
-      if (router_get_by_descriptor_digest(rs->descriptor_digest)) {
+      signed_descriptor_t *sd;
+      if ((sd = router_get_by_descriptor_digest(rs->descriptor_digest))) {
+        routerinfo_t *ri;
         ++n_have;
+        if (!(ri = router_get_by_digest(rs->identity_digest)) ||
+            memcmp(ri->cache_info.signed_descriptor_digest,
+                   sd->signed_descriptor_digest, DIGEST_LEN)) {
+          ++n_in_oldrouters;
+        }
         continue; /* We have it already. */
       }
       if (!download_status_is_ready(&rs->dl_status, now,
@@ -3748,10 +3755,11 @@ update_consensus_router_descriptor_downloads(time_t now)
     });
 
   log_info(LD_DIR,
-           "%d routers downloadable. %d delayed; %d present; %d would_reject; "
+           "%d routers downloadable. %d delayed; %d present "
+           "(%d of those in old_routers); %d would_reject; "
            "%d wouldnt_use, %d in progress.",
-           smartlist_len(downloadable), n_delayed, n_have, n_would_reject,
-           n_wouldnt_use, n_inprogress);
+           smartlist_len(downloadable), n_delayed, n_have, n_in_oldrouters,
+           n_would_reject, n_wouldnt_use, n_inprogress);
 
   launch_router_descriptor_downloads(downloadable, now);