[or-cvs] r11961: Fix last patch. (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Tue Oct 16 02:15:42 UTC 2007


Author: nickm
Date: 2007-10-15 22:15:41 -0400 (Mon, 15 Oct 2007)
New Revision: 11961

Modified:
   tor/trunk/
   tor/trunk/src/or/networkstatus.c
Log:
 r15814 at catbus:  nickm | 2007-10-15 22:15:19 -0400
 Fix last patch.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15814] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/networkstatus.c
===================================================================
--- tor/trunk/src/or/networkstatus.c	2007-10-16 02:06:30 UTC (rev 11960)
+++ tor/trunk/src/or/networkstatus.c	2007-10-16 02:15:41 UTC (rev 11961)
@@ -864,18 +864,16 @@
   SMARTLIST_FOREACH(new_c->routerstatus_list, routerstatus_t *, rs_new,
   {
     int r;
-    while (rs_old && /* XXX020 Nick, solve this: sometimes rs_old is NULL */
-           (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) /* XXX020 Nick, solve this: sometimes it's -1 which doesn't
-              * match your comment below. */
-      continue;
+    tor_assert(r==0);
+
     /* Okay, so we're looking at the same identity. */
     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 @@
     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)) {
         /* We're out of routerstatuses. Bail. */
         goto done;
       }
-      rs = smartlist_get(ns->routerstatus_list, ++idx);
+      rs = smartlist_get(ns->routerstatus_list, idx);
     }
     if (r>0) {
       /* We have no routerstatus for this router. Skip it. */
       continue;
     }
+    tor_assert(r==0);
 
     ds = router_get_trusteddirserver_by_digest(digest);
 



More information about the tor-commits mailing list