diff options
author | EvilSeph <evilseph@gmail.com> | 2012-03-22 08:03:24 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-22 16:56:15 -0400 |
commit | c2cdeac09b03691241358d106671a801dc2d6fa4 (patch) | |
tree | 0fa4fac0334c15a9f6c47fcb69bdbf1376f65dcf /src/main/java | |
parent | dda37aa18c16c210c20b184fe1482b41a58db055 (diff) | |
download | craftbukkit-c2cdeac09b03691241358d106671a801dc2d6fa4.tar craftbukkit-c2cdeac09b03691241358d106671a801dc2d6fa4.tar.gz craftbukkit-c2cdeac09b03691241358d106671a801dc2d6fa4.tar.lz craftbukkit-c2cdeac09b03691241358d106671a801dc2d6fa4.tar.xz craftbukkit-c2cdeac09b03691241358d106671a801dc2d6fa4.zip |
Added configurable Connection Throttle. Addresses BUKKIT-1274
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/NetworkAcceptThread.java | 5 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftServer.java | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/NetworkAcceptThread.java b/src/main/java/net/minecraft/server/NetworkAcceptThread.java index 005d61bb..2937aee8 100644 --- a/src/main/java/net/minecraft/server/NetworkAcceptThread.java +++ b/src/main/java/net/minecraft/server/NetworkAcceptThread.java @@ -10,6 +10,8 @@ class NetworkAcceptThread extends Thread { final NetworkListenThread listenThread; + long connectionThrottle; // CraftBukkit + NetworkAcceptThread(NetworkListenThread networklistenthread, String s, MinecraftServer minecraftserver) { super(s); this.listenThread = networklistenthread; @@ -24,9 +26,10 @@ class NetworkAcceptThread extends Thread { if (socket != null) { synchronized (NetworkListenThread.getRecentConnectionAttempts(this.listenThread)) { InetAddress inetaddress = socket.getInetAddress(); + connectionThrottle = this.a.server.getConnectionThrottle(); // CraftBukkit // CraftBukkit - if (NetworkListenThread.getRecentConnectionAttempts(this.listenThread).containsKey(inetaddress) && System.currentTimeMillis() - ((Long) NetworkListenThread.getRecentConnectionAttempts(this.listenThread).get(inetaddress)).longValue() < 4000L) { + if (NetworkListenThread.getRecentConnectionAttempts(this.listenThread).containsKey(inetaddress) && System.currentTimeMillis() - ((Long) NetworkListenThread.getRecentConnectionAttempts(this.listenThread).get(inetaddress)).longValue() < connectionThrottle) { NetworkListenThread.getRecentConnectionAttempts(this.listenThread).put(inetaddress, Long.valueOf(System.currentTimeMillis())); socket.close(); continue; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 617676a7..8e6bdd41 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -424,6 +424,10 @@ public final class CraftServer implements Server { return this.configuration.getInt("settings.ping-packet-limit", 100); } + public long getConnectionThrottle() { + return this.configuration.getInt("settings.connection-throttle"); + } + public int getTicksPerAnimalSpawns() { return this.configuration.getInt("ticks-per.animal-spawns"); } |