|
@@ -864,18 +864,16 @@ networkstatus_copy_old_consensus_info(networkstatus_vote_t *new_c,
|
|
|
SMARTLIST_FOREACH(new_c->routerstatus_list, routerstatus_t *, rs_new,
|
|
|
{
|
|
|
int r;
|
|
|
- while (rs_old &&
|
|
|
- (r = memcmp(rs_old->identity_digest, rs_new->identity_digest,
|
|
|
+ while ((r = memcmp(rs_old->identity_digest, rs_new->identity_digest,
|
|
|
DIGEST_LEN))<0) {
|
|
|
- if (idx == smartlist_len(old_c->routerstatus_list))
|
|
|
+ if (++idx == smartlist_len(old_c->routerstatus_list))
|
|
|
goto done;
|
|
|
- rs_old = smartlist_get(old_c->routerstatus_list, ++idx);
|
|
|
+ rs_old = smartlist_get(old_c->routerstatus_list, idx);
|
|
|
}
|
|
|
if (r>0)
|
|
|
continue;
|
|
|
- if (r<0)
|
|
|
- * match your comment below. */
|
|
|
- continue;
|
|
|
+ tor_assert(r==0);
|
|
|
+
|
|
|
|
|
|
rs_new->name_lookup_warned = rs_old->name_lookup_warned;
|
|
|
rs_new->last_dir_503_at = rs_old->last_dir_503_at;
|
|
@@ -1167,16 +1165,17 @@ routers_update_status_from_consensus_networkstatus(smartlist_t *routers,
|
|
|
const char *digest = router->cache_info.identity_digest;
|
|
|
int r;
|
|
|
while ((r = memcmp(rs->identity_digest, digest, DIGEST_LEN))<0) {
|
|
|
- if (idx == smartlist_len(ns->routerstatus_list)) {
|
|
|
+ if (++idx == smartlist_len(ns->routerstatus_list)) {
|
|
|
|
|
|
goto done;
|
|
|
}
|
|
|
- rs = smartlist_get(ns->routerstatus_list, ++idx);
|
|
|
+ rs = smartlist_get(ns->routerstatus_list, idx);
|
|
|
}
|
|
|
if (r>0) {
|
|
|
|
|
|
continue;
|
|
|
}
|
|
|
+ tor_assert(r==0);
|
|
|
|
|
|
ds = router_get_trusteddirserver_by_digest(digest);
|
|
|
|