mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Three more assertions which hopefully are sane, Nick? They might help track down #417.
svn:r10720
This commit is contained in:
parent
1bdcfd9203
commit
ea1348360e
@ -1867,6 +1867,7 @@ routerlist_is_overfull(routerlist_t *rl)
|
|||||||
static INLINE int
|
static INLINE int
|
||||||
_routerlist_find_elt(smartlist_t *sl, void *ri, int idx)
|
_routerlist_find_elt(smartlist_t *sl, void *ri, int idx)
|
||||||
{
|
{
|
||||||
|
tor_assert(idx < sl->num_used);
|
||||||
if (idx < 0 || smartlist_get(sl, idx) != ri) {
|
if (idx < 0 || smartlist_get(sl, idx) != ri) {
|
||||||
idx = -1;
|
idx = -1;
|
||||||
SMARTLIST_FOREACH(sl, routerinfo_t *, r,
|
SMARTLIST_FOREACH(sl, routerinfo_t *, r,
|
||||||
@ -2125,6 +2126,7 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
|
|||||||
smartlist_set(rl->routers, idx, ri_new);
|
smartlist_set(rl->routers, idx, ri_new);
|
||||||
ri_old->routerlist_index = -1;
|
ri_old->routerlist_index = -1;
|
||||||
ri_new->routerlist_index = idx;
|
ri_new->routerlist_index = idx;
|
||||||
|
tor_assert( _routerlist_find_elt(rl->routers, ri_old, 0) == -1 );
|
||||||
} else {
|
} else {
|
||||||
log_warn(LD_BUG, "Appending entry from routerlist_replace.");
|
log_warn(LD_BUG, "Appending entry from routerlist_replace.");
|
||||||
routerlist_insert(rl, ri_new);
|
routerlist_insert(rl, ri_new);
|
||||||
@ -2420,6 +2422,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
|||||||
router->cache_info.identity_digest);
|
router->cache_info.identity_digest);
|
||||||
if (old_router) {
|
if (old_router) {
|
||||||
int pos = old_router->routerlist_index;
|
int pos = old_router->routerlist_index;
|
||||||
|
tor_assert(0 <= pos && pos < routerlist->routers->num_used);
|
||||||
tor_assert(smartlist_get(routerlist->routers, pos) == old_router);
|
tor_assert(smartlist_get(routerlist->routers, pos) == old_router);
|
||||||
|
|
||||||
if (router->cache_info.published_on <=
|
if (router->cache_info.published_on <=
|
||||||
|
Loading…
Reference in New Issue
Block a user