diff options
author | Peter Palfrader <peter@palfrader.org> | 2007-07-02 20:17:12 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2007-07-02 20:17:12 +0000 |
commit | 64f4cff192909a1e7338bf86f714a7fd8f457793 (patch) | |
tree | 6c5d7ff6bc680f87b0e1a529432b300acdb05022 /src | |
parent | d071df748a51bd8fc21143cf0559437ebc936679 (diff) | |
download | tor-64f4cff192909a1e7338bf86f714a7fd8f457793.tar.gz tor-64f4cff192909a1e7338bf86f714a7fd8f457793.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/or/routerlist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 6703ef7e35..f9efc3f301 100644 --- a/src/or/routerlist.c +++ b/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; } |