[tor-commits] [tor/release-0.2.8] stop looping once we know what the answer will be
nickm at torproject.org
nickm at torproject.org
Thu May 19 12:30:30 UTC 2016
commit aa6341d4b9159e02825a03f1490ce6b731c2a90e
Author: Roger Dingledine <arma at torproject.org>
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);
More information about the tor-commits
mailing list