From 03a20a05f75766e207954b125d390bc667962ee5 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Wed, 27 Feb 2019 16:08:33 +0100 Subject: [PATCH] Fixed memory leak in message throttle mechanism --- p2p/src/main/java/bisq/network/p2p/network/Connection.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/p2p/src/main/java/bisq/network/p2p/network/Connection.java b/p2p/src/main/java/bisq/network/p2p/network/Connection.java index ad92ef25ee3..16c1758f992 100644 --- a/p2p/src/main/java/bisq/network/p2p/network/Connection.java +++ b/p2p/src/main/java/bisq/network/p2p/network/Connection.java @@ -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;