Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Apply a limit to the number of responses in RespondingEthPeer.respond…
Browse files Browse the repository at this point in the history
…While so tests don't hang forever when the condition isn't met. (#803)
  • Loading branch information
ajsutton authored Feb 7, 2019
1 parent dcfe248 commit f4d9ac3
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,15 @@ public EthPeer getEthPeer() {
}

public void respondWhile(final Responder responder, final RespondWhileCondition condition) {
int counter = 0;
while (condition.shouldRespond()) {
respond(responder);
counter++;
if (counter > 10_000) {
// Limit applied to avoid tests hanging forever which is hard to track down.
throw new IllegalStateException(
"Responded 10,000 times and stop condition still not reached.");
}
}
}

Expand Down

0 comments on commit f4d9ac3

Please sign in to comment.