[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/release-0.2.8] stop looping once we know what the answer will be



commit aa6341d4b9159e02825a03f1490ce6b731c2a90e
Author: Roger Dingledine <arma@xxxxxxxxxxxxxx>
Date:   Fri May 6 09:55:06 2016 -0400

    stop looping once we know what the answer will be
    
    suggested during code review by dgoulet
---
 src/or/networkstatus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 3d8bb55..074922b 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1347,8 +1347,10 @@ networkstatus_consensus_is_already_downloading(const char *resource)
     connection_t *base = TO_CONN(dirconn);
     if (base->linked_conn &&
         base->linked_conn->type == CONN_TYPE_AP &&
-        !AP_CONN_STATE_IS_UNATTACHED(base->linked_conn->state))
+        !AP_CONN_STATE_IS_UNATTACHED(base->linked_conn->state)) {
       answer = 1;
+      break; /* stop looping, because we know the answer will be yes */
+    }
   } SMARTLIST_FOREACH_END(dirconn);
   smartlist_free(fetching_conns);
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits