I am currently analysing the source code of Monero. If a node makes a new connection, it first checks what fraction of its current outgoing connections are to nodes in its white list. If it is above an expected fraction (default is 70 percent), then it attempts to connect to grey-listed peers and then (if necessary) white-listed peers. However, If I understand that part of the code correctly, it will try all grey peers to create a connection. In case we want to connect to a white peer, we will try a limited (probably 3 iteration and we try 20 peers per iteration) number of peers.
Has anybody an idea why the developers chose to do it that way? Isn't it wasteful to try the whole grey list (up to 5,000 entries)? Where at the same time we maintain a white list of probably online peers?