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

Apply a limit to the number of responses in RespondingEthPeer.respondWhile #803

Merged
merged 2 commits into from
Feb 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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