From 16f131ee2d03b673ba768cd691d8190086ade0d4 Mon Sep 17 00:00:00 2001 From: games647 Date: Mon, 8 Feb 2021 11:44:06 +0100 Subject: [PATCH] Limit expire timer --- .../games647/fastlogin/core/shared/FastLoginCore.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java index 240f8ebc..3e57e150 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java @@ -47,6 +47,8 @@ import static java.util.stream.Collectors.toSet; */ public class FastLoginCore

> { + private static final long MAX_EXPIRE_RATE = 1_000_000; + private final Map localeMessages = new ConcurrentHashMap<>(); private final ConcurrentMap pendingLogin = CommonUtil.buildCache(5, -1); private final Collection pendingConfirms = new HashSet<>(); @@ -88,8 +90,12 @@ public class FastLoginCore

> { } int maxCon = config.getInt("anti-bot.connections", 200); - int expireTime = config.getInt("anti-bot.expire", 5); - rateLimiter = new RateLimiter(maxCon, expireTime * 60 * 1_000); + long expireTime = config.getInt("anti-bot.expire", 5) * 60 * 1_000L; + if (expireTime > MAX_EXPIRE_RATE) { + expireTime = MAX_EXPIRE_RATE; + } + + rateLimiter = new RateLimiter(maxCon, expireTime); Set proxies = config.getStringList("proxies") .stream() .map(HostAndPort::fromString)