Within the interior loop of ThreadOpenConnections() typically there’s a break to the outer loop and typically a proceed. That is my understanding of the distinction, roughly:
- A break absolutely ‘restarts’ the seek for an outward connection, the kind of which shall be decided once more. Additionally new incoming potential friends shall be included within the addrman tables.
- A proceed effectivily simply asks addrman for a subsequent candidate peer from the prevailing tables. The kind of outward connection that we want for stays the identical.
My query is concerning the selection of break versus proceed in two circumstances. Right here the code does a break:
// if we chosen an invalid or native deal with, restart
if (!addr.IsValid() || IsLocal(addr)) {
break;
}
Whereas a couple of strains under it continues:
if (!IsReachable(addr))
proceed;
My query is: why ‘restart’ within the first code snippet and never proceed? In different phrases: why not ask addrman a couple of instances extra, as it would provide a legitimate deal with quickly? Or, for the second snippet, if we acquired an unreachable deal with: why not restart, so addrman may get refreshed with extra reachable addresses?
I attempted to search out the reply by monitoring again the historical past of this a part of the code. The break within the first code snippet above seems to stem from the introduction of the deal with supervisor (pr/787). It didn’t appear to reply my query.
