Skip to content

Commit

Permalink
Properly fix checkAllowConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
adryd325 committed Jun 26, 2023
1 parent 534ee46 commit c54f960
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ yarn_mappings=1.20.1+build.1
loader_version=0.14.21

# Mod Properties
mod_version = 1.0.5
mod_version = 1.0.6
maven_group = com.adryd
archives_base_name = sneaky

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/adryd/sneaky/Sneaky.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public static boolean checkAllowConnection(SocketAddress address) {
return true;
}
String addressStr = stringifyAddress(address);
int attempts = rateLimitMap.get(addressStr);
if (attempts == 0) {
rateLimitMap.put(addressStr, 1);
return true;
} else {
if (rateLimitMap.containsKey(addressStr)) {
int attempts = rateLimitMap.get(addressStr);
attempts++;
rateLimitMap.put(addressStr, attempts);
rateLimitMap.replace(addressStr, attempts);
return attempts < Config.INSTANCE.getNewConnectionRateLimit();
} else {
rateLimitMap.put(addressStr, 1);
return true;
}
}

Expand Down

0 comments on commit c54f960

Please sign in to comment.