Browse Source

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

svn:r10727
Peter Palfrader 17 years ago
parent
commit
64f4cff192
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/or/routerlist.c

+ 5 - 3
src/or/routerlist.c

@@ -1867,15 +1867,17 @@ routerlist_is_overfull(routerlist_t *rl)
 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;
 }