[or-cvs] r10727: I so wonder how this blows up on the real network - make _ro (tor/trunk/src/or)
weasel at seul.org
weasel at seul.org
Mon Jul 2 20:17:12 UTC 2007
Author: weasel
Date: 2007-07-02 16:17:12 -0400 (Mon, 02 Jul 2007)
New Revision: 10727
Modified:
tor/trunk/src/or/routerlist.c
Log:
I so wonder how this blows up on the real network - make _routerlist_find_elt be strict about the idx it is passed - if it is not -1 then it has to be correct
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2007-07-02 20:04:26 UTC (rev 10726)
+++ tor/trunk/src/or/routerlist.c 2007-07-02 20:17:12 UTC (rev 10727)
@@ -1867,15 +1867,17 @@
static INLINE int
_routerlist_find_elt(smartlist_t *sl, void *ri, int idx)
{
- tor_assert(idx < smartlist_len(sl));
- if (idx < 0 || smartlist_get(sl, idx) != ri) {
+ if (idx < 0) {
idx = -1;
SMARTLIST_FOREACH(sl, routerinfo_t *, r,
if (r == ri) {
idx = r_sl_idx;
break;
});
- }
+ } else {
+ tor_assert(idx < smartlist_len(sl));
+ tor_assert(smartlist_get(sl, idx) == ri);
+ };
return idx;
}
More information about the tor-commits
mailing list