summaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2016-05-06 09:55:06 -0400
committerRoger Dingledine <arma@torproject.org>2016-05-09 14:42:42 -0400
commitaa6341d4b9159e02825a03f1490ce6b731c2a90e (patch)
tree2f764e9c8941b30e0324f2a21166d35e0a3cd1fa /src/or/networkstatus.c
parent1f72653544272e24d685bd81abe2da5d32b67caf (diff)
downloadtor-aa6341d4b9159e02825a03f1490ce6b731c2a90e.tar.gz
tor-aa6341d4b9159e02825a03f1490ce6b731c2a90e.zip
stop looping once we know what the answer will be
suggested during code review by dgoulet
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 3d8bb55fc3..074922bcf0 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);