summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2007-08-13 22:57:03 +0000
committerPeter Palfrader <peter@palfrader.org>2007-08-13 22:57:03 +0000
commitc79aed0ec5fce2625850ff3194ac607e33253f7e (patch)
tree18b385655b01f6ba2b3bfa83635577f70989f443
parentaacc56bdf2490c0a12885617813ccc2075dc780e (diff)
downloadtor-c79aed0ec5fce2625850ff3194ac607e33253f7e.tar.gz
tor-c79aed0ec5fce2625850ff3194ac607e33253f7e.zip
Save on most routerlist_assert_ok() calls in routerlist.c, thus greatly
speeding up loading cached-routers from disk on startup (backport from trunk). svn:r11096
-rw-r--r--ChangeLog6
-rw-r--r--src/or/routerlist.c12
2 files changed, 18 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3021431591..502ba4c408 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Changes in version 0.1.2.xx - 2007-xxxxx
+ o
+ - Save on most routerlist_assert_ok() calls in routerlist.c,
+ thus greatly speeding up loading cached-routers from disk on
+ startup (backport from trunk).
+
Changes in version 0.1.2.16 - 2007-08-01
o Major security fixes:
- Close immediately after missing authentication on control port;
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 446ed06250..5dc935eab0 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -15,6 +15,8 @@ const char routerlist_c_id[] =
#include "or.h"
+// #define DEBUG_ROUTERLIST
+
/****************************************************************************/
/* static function prototypes */
@@ -1612,7 +1614,9 @@ routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
smartlist_add(rl->routers, ri);
ri->routerlist_index = smartlist_len(rl->routers) - 1;
router_dir_info_changed();
+#ifdef DEBUG_ROUTERLIST
routerlist_assert_ok(rl);
+#endif
}
/** If we're a directory cache and routerlist <b>rl</b> doesn't have
@@ -1635,7 +1639,9 @@ routerlist_insert_old(routerlist_t *rl, routerinfo_t *ri)
} else {
routerinfo_free(ri);
}
+#ifdef DEBUG_ROUTERLIST
routerlist_assert_ok(rl);
+#endif
}
/** Remove an item <b>ri</b> from the routerlist <b>rl</b>, updating indices
@@ -1672,7 +1678,9 @@ routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int idx, int make_old)
router_bytes_dropped += ri->cache_info.signed_descriptor_len;
routerinfo_free(ri);
}
+#ifdef DEBUG_ROUTERLIST
routerlist_assert_ok(rl);
+#endif
}
/** DOCDOC */
@@ -1689,7 +1697,9 @@ routerlist_remove_old(routerlist_t *rl, signed_descriptor_t *sd, int idx)
tor_assert(sd_tmp == sd);
router_bytes_dropped += sd->signed_descriptor_len;
signed_descriptor_free(sd);
+#ifdef DEBUG_ROUTERLIST
routerlist_assert_ok(rl);
+#endif
}
/** Remove <b>ri_old</b> from the routerlist <b>rl</b>, and replace it with
@@ -1746,7 +1756,9 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
router_bytes_dropped += ri_old->cache_info.signed_descriptor_len;
routerinfo_free(ri_old);
}
+#ifdef DEBUG_ROUTERLIST
routerlist_assert_ok(rl);
+#endif
}
/** Free all memory held by the routerlist module. */