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
This commit is contained in:
Peter Palfrader 2007-07-02 20:17:12 +00:00
parent d071df748a
commit 64f4cff192

View file

@ -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;
}