Network down race condition might lead to primary guards getting skipped
tries to ensure that if our network is down, and connections to already existing guards fail, when the network is back up we will still try to connect to the guards on the top of our list.
It does so, by checking whether the guard we connected to is a newly added one. If it is so, it assumes that this guard was added because all our previous guards were found to be down, which might be a sign of the network being down. So if that's the case, the code walks our guard list and marks all the previous guards as to be retried.
This usually works fine, but consider the case where we have 60 guards in our guard list, and the network goes back up when we walk through the 50th guard. If that's the case, the code at https://gitweb.torproject.org/tor.git/blob/d064773595f1d0bf1b76dd6f7439bff653a3c8ce:/src/or/entrynodes.c#l776 doesn't get triggered because
first_contact is not true, and we still stay connected to the 50th guard.
This sounds like a bug, since we should try to connect to our primary guards (the ones at the top of the list) even then.