Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/query/peers/closest: Consider all peers at initialization
Instead of initializing the iterator with `num_results` amount of nodes, discarding the remaining, initialize the iterator with all provided peers. This patch allows the following scenario: > Given an iterator with the configured goal of 1 result and an initial set of peers of 2, one would expect the iterator to try the second peer in case the first fails. There is a downside to this patch. Say the iterator is initialized with 100 peers. Each peer is doomed to fail. In this case the iterator will try each peer resulting in many connection attempts. While the previous state is a safeguard against the scenario above, the same could happen when the iterator is configured with num_result of 10, the 9 first peers return 100 peers, each of them being doomed to fail, thus the iterator would again attempt to make 100 connections only to fail overall.
- Loading branch information