Skip to content

Commit

Permalink
Fixed memory leak in message throttle mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
freimair committed Feb 27, 2019
1 parent b6bf22b commit 03a20a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions p2p/src/main/java/bisq/network/p2p/network/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,10 @@ private boolean violatesThrottleLimit(NetworkEnvelope networkEnvelope) {
.collect(Collectors.toList()).toString());
}
}
// we limit to max 1000 (MSG_THROTTLE_PER_10SEC) entries
messageTimeStamps.remove(0);
}
// we limit to max 1000 (MSG_THROTTLE_PER_10SEC) entries
while(messageTimeStamps.size() > MSG_THROTTLE_PER_10_SEC)
messageTimeStamps.remove(0);

messageTimeStamps.add(new Tuple2<>(now, networkEnvelope));
return violated;
Expand Down

0 comments on commit 03a20a0

Please sign in to comment.