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

[or-cvs] r10244: Partial backport candidate. Fix issue noted in r10241: store (in tor/trunk: . src/or)



Author: nickm
Date: 2007-05-21 21:51:53 -0400 (Mon, 21 May 2007)
New Revision: 10244

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/routerlist.c
Log:
 r12842@catbus:  nickm | 2007-05-21 21:51:45 -0400
 Partial backport candidate. Fix issue noted in r10241: stores were rebuilt too often.  Also notes dropped bytes better.



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

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-05-22 01:39:31 UTC (rev 10243)
+++ tor/trunk/ChangeLog	2007-05-22 01:51:53 UTC (rev 10244)
@@ -159,6 +159,8 @@
     - When choosing an entry guard for our circuit, avoid using guards
       that are in the same family as the chosen exit -- not just guards
       that are exactly the chosen exit. (Reported by lodger.)
+    - Don't rebuild the entire router store just because we got 32K of
+      routers.
 
   o Minor bugfixes (controller):
     - Make 'getinfo fingerprint' return a 551 error if we're not a

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-05-22 01:39:31 UTC (rev 10243)
+++ tor/trunk/src/or/routerlist.c	2007-05-22 01:51:53 UTC (rev 10244)
@@ -271,7 +271,6 @@
 static int
 router_rebuild_store(int force, int extrainfo)
 {
-  size_t len = 0; /* XXX020 never used */
   or_options_t *options;
   size_t fname_len;
   smartlist_t *chunk_list = NULL;
@@ -394,7 +393,8 @@
   write_str_to_file(fname, "", 1);
 
   r = 0;
-  stats->store_len = len; /* XXX020 always 0 */
+  tor_assert(offset > 0);
+  stats->store_len = (size_t) offset;
   stats->journal_len = 0;
   stats->bytes_dropped = 0;
  done:
@@ -1827,8 +1827,11 @@
                          ei->cache_info.signed_descriptor_digest,
                          ei);
   r = 1;
-  if (ei_tmp)
+  if (ei_tmp) {
+    extrainfo_store_stats.bytes_dropped +=
+      ei_tmp->cache_info.signed_descriptor_len;
     extrainfo_free(ei_tmp);
+  }
 
  done:
   if (r == 0)
@@ -2035,6 +2038,8 @@
     if (!tor_digest_is_zero(ri_old->cache_info.extra_info_digest))
       digestmap_remove(rl->desc_by_eid_map,
                        ri_old->cache_info.extra_info_digest);
+    router_store_stats.bytes_ropped +=
+      ri_old->cache_info.signed_descriptor_len;
     routerinfo_free(ri_old);
   }
 #ifdef DEBUG_ROUTERLIST