stop looping once we know what the answer will be

suggested during code review by dgoulet
This commit is contained in:
Roger Dingledine 2016-05-06 09:55:06 -04:00
parent 1f72653544
commit aa6341d4b9

View File

@ -1347,8 +1347,10 @@ networkstatus_consensus_is_already_downloading(const char *resource)
connection_t *base = TO_CONN(dirconn); connection_t *base = TO_CONN(dirconn);
if (base->linked_conn && if (base->linked_conn &&
base->linked_conn->type == CONN_TYPE_AP && 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; answer = 1;
break; /* stop looping, because we know the answer will be yes */
}
} SMARTLIST_FOREACH_END(dirconn); } SMARTLIST_FOREACH_END(dirconn);
smartlist_free(fetching_conns); smartlist_free(fetching_conns);