Get a random peer, but try our preferred peer first, if any. This * biasses us to the peer that told us of unexpected gossip. */
| 157 | /* Get a random peer, but try our preferred peer first, if any. This |
| 158 | * biasses us to the peer that told us of unexpected gossip. */ |
| 159 | static struct peer *random_seeker(struct seeker *seeker, |
| 160 | bool (*check_peer)(const struct peer *peer)) |
| 161 | { |
| 162 | struct peer *peer = seeker->preferred_peer_softref; |
| 163 | |
| 164 | /* 80% chance of immediately choosing a peer who reported the missing |
| 165 | * stuff: they presumably can tell us more about it. We don't |
| 166 | * *always* choose it because it could be simply spamming us with |
| 167 | * invalid announcements to get chosen, and we don't handle that case |
| 168 | * well yet. */ |
| 169 | if (peer && check_peer(peer) && pseudorand(5) != 0) { |
| 170 | clear_softref(seeker, &seeker->random_peer_softref); |
| 171 | return peer; |
| 172 | } |
| 173 | |
| 174 | return random_peer(seeker->daemon, check_peer); |
| 175 | } |
| 176 | |
| 177 | static bool peer_made_progress(struct seeker *seeker) |
| 178 | { |
no test coverage detected