Use our throttle method, diff needs a little bit of work. May be buggy, use with care.

This commit is contained in:
md_5 2013-06-24 07:42:20 +10:00
parent 7b558570ea
commit 1aa048c61e

View file

@ -1,4 +1,4 @@
From 621ccf948dca29b783bec47193d22a899efb586d Mon Sep 17 00:00:00 2001
From f2ce2a2090688544df1fe5fd7d33ee5df2e98ada Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 23 Jun 2013 16:32:51 +1000
Subject: [PATCH] Netty
@ -45,10 +45,33 @@ index 59444cb..9e6e318 100644
this.getLogger().warning("**** FAILED TO BIND TO PORT!");
this.getLogger().warning("The exception was: {0}", new Object[] { ioexception.toString()});
diff --git a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
index ef7e10d..5f2e42e 100644
index ef7e10d..e25819d 100644
--- a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
+++ b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
@@ -82,7 +82,7 @@ public class DedicatedServerConnectionThread extends Thread {
@@ -66,23 +66,19 @@ public class DedicatedServerConnectionThread extends Thread {
socket.close();
continue;
}
+ // CraftBukkit end
- connectionThrottle = ((MinecraftServer) this.e.d()).server.getConnectionThrottle();
-
- synchronized (this.b) {
- if (this.b.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ((Long) this.b.get(address)).longValue() < connectionThrottle) {
- this.b.put(address, Long.valueOf(currentTime));
- socket.close();
- continue;
- }
-
- this.b.put(address, Long.valueOf(currentTime));
+ // Spigot Start
+ if ( ( (org.spigotmc.MultiplexingServerConnection) MinecraftServer.getServer().ae() ).throttle( address ) )
+ {
+ socket.close();
+ continue;
}
- // CraftBukkit end
+ // Spigot end
PendingConnection pendingconnection = new PendingConnection(this.e.d(), socket, "Connection #" + this.c++);