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

[or-cvs] r10306: Make reset_download_failures() reset extrainfo download stat (in tor/trunk: . src/or)



Author: nickm
Date: 2007-05-24 13:13:02 -0400 (Thu, 24 May 2007)
New Revision: 10306

Modified:
   tor/trunk/
   tor/trunk/src/or/routerlist.c
Log:
 r12918@catbus:  nickm | 2007-05-24 12:52:40 -0400
 Make reset_download_failures() reset extrainfo download status too.



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

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-05-24 17:13:00 UTC (rev 10305)
+++ tor/trunk/src/or/routerlist.c	2007-05-24 17:13:02 UTC (rev 10306)
@@ -3159,16 +3159,7 @@
 {
   if (!routerstatus_by_desc_digest_map)
     return NULL;
-#if 0
-  /* XXXX020 this could conceivably be critical path when a whole lot
-   * of descriptors fail.  Maybe we should use a digest map instead.*/
-  SMARTLIST_FOREACH(routerstatus_list, local_routerstatus_t *, lrs,
-                    if (!memcmp(lrs->status.descriptor_digest, digest))
-                      return lrs);
-  return NULL;
-#else
   return digestmap_get(routerstatus_by_desc_digest_map, digest);
-#endif
 }
 
 /** Given a nickname (possibly verbose, possibly a hexadecimal digest), return
@@ -4875,7 +4866,6 @@
     rs->dl_status.n_download_failures = 0;
     rs->dl_status.next_attempt_at = 0;
   });
-  /* XXXX020 reset extrainfo dl status too. */
   tor_assert(networkstatus_list);
   SMARTLIST_FOREACH(networkstatus_list, networkstatus_t *, ns,
      SMARTLIST_FOREACH(ns->entries, routerstatus_t *, rs,
@@ -4884,6 +4874,19 @@
            rs->need_to_mirror = 1;
        }));
   last_routerdesc_download_attempted = 0;
+  if (!routerlist)
+    return;
+  SMARTLIST_FOREACH(routerlist->routers, routerinfo_t *, ri,
+  {
+    ri->cache_info.ei_dl_status.n_download_failures = 0;
+    ri->cache_info.ei_dl_status.next_attempt_at = 0;
+  });
+  SMARTLIST_FOREACH(routerlist->old_routers, signed_descriptor_t *, sd,
+  {
+    sd->ei_dl_status.n_download_failures = 0;
+    sd->ei_dl_status.next_attempt_at = 0;
+  });
+
 }
 
 /** Any changes in a router descriptor's publication time larger than this are