diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-13 17:33:27 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-15 13:28:59 -0500 |
commit | 83d29e461c85733f0113b6eb19db6e3b42da2949 (patch) | |
tree | b3063a1c28f478ab368d5ba3413a842def68c28f /src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java | |
parent | ba6e4c38cfa98ad291974195cc46d70a4f138ac1 (diff) | |
download | craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.gz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.lz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.xz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.zip |
Update CraftBukkit to Minecraft 1.5
Diffstat (limited to 'src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java')
-rw-r--r-- | src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java | 79 |
1 files changed, 38 insertions, 41 deletions
diff --git a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java index 25e2ac1d..5be8dc2b 100644 --- a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java +++ b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java @@ -8,47 +8,44 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; public class DedicatedServerConnectionThread extends Thread { - private static Logger a = Logger.getLogger("Minecraft"); - private final List b = Collections.synchronizedList(new ArrayList()); - private final HashMap c = new HashMap(); - private int d = 0; - private final ServerSocket e; - private ServerConnection f; - private final InetAddress g; - private final int h; + private final List a = Collections.synchronizedList(new ArrayList()); + private final HashMap b = new HashMap(); + private int c = 0; + private final ServerSocket d; + private ServerConnection e; + private final InetAddress f; + private final int g; long connectionThrottle; // CraftBukkit public DedicatedServerConnectionThread(ServerConnection serverconnection, InetAddress inetaddress, int i) throws IOException { // CraftBukkit - added throws super("Listen thread"); - this.f = serverconnection; - this.h = i; - this.e = new ServerSocket(i, 0, inetaddress); - this.g = inetaddress == null ? this.e.getInetAddress() : inetaddress; - this.e.setPerformancePreferences(0, 2, 1); + this.e = serverconnection; + this.g = i; + this.d = new ServerSocket(i, 0, inetaddress); + this.f = inetaddress == null ? this.d.getInetAddress() : inetaddress; + this.d.setPerformancePreferences(0, 2, 1); } public void a() { - List list = this.b; + List list = this.a; - synchronized (this.b) { - for (int i = 0; i < this.b.size(); ++i) { - PendingConnection pendingconnection = (PendingConnection) this.b.get(i); + synchronized (this.a) { + for (int i = 0; i < this.a.size(); ++i) { + PendingConnection pendingconnection = (PendingConnection) this.a.get(i); try { pendingconnection.c(); } catch (Exception exception) { pendingconnection.disconnect("Internal server error"); - a.log(Level.WARNING, "Failed to handle packet for " + pendingconnection.getName() + ": " + exception, exception); + this.e.d().getLogger().warning("Failed to handle packet for " + pendingconnection.getName() + ": " + exception, (Throwable) exception); } - if (pendingconnection.c) { - this.b.remove(i--); + if (pendingconnection.b) { + this.a.remove(i--); } pendingconnection.networkManager.a(); @@ -57,51 +54,51 @@ public class DedicatedServerConnectionThread extends Thread { } public void run() { - while (this.f.b) { + while (this.e.a) { try { - Socket socket = this.e.accept(); + Socket socket = this.d.accept(); InetAddress inetaddress = socket.getInetAddress(); long i = System.currentTimeMillis(); - HashMap hashmap = this.c; + HashMap hashmap = this.b; // CraftBukkit start - if (((MinecraftServer) this.f.d()).server == null) { + if (((MinecraftServer) this.e.d()).server == null) { socket.close(); continue; } - connectionThrottle = ((MinecraftServer) this.f.d()).server.getConnectionThrottle(); + connectionThrottle = ((MinecraftServer) this.e.d()).server.getConnectionThrottle(); // CraftBukkit end - synchronized (this.c) { - if (this.c.containsKey(inetaddress) && !b(inetaddress) && i - ((Long) this.c.get(inetaddress)).longValue() < connectionThrottle) { - this.c.put(inetaddress, Long.valueOf(i)); + synchronized (this.b) { + if (this.b.containsKey(inetaddress) && !b(inetaddress) && i - ((Long) this.b.get(inetaddress)).longValue() < connectionThrottle) { + this.b.put(inetaddress, Long.valueOf(i)); socket.close(); continue; } - this.c.put(inetaddress, Long.valueOf(i)); + this.b.put(inetaddress, Long.valueOf(i)); } - PendingConnection pendingconnection = new PendingConnection(this.f.d(), socket, "Connection #" + this.d++); + PendingConnection pendingconnection = new PendingConnection(this.e.d(), socket, "Connection #" + this.c++); this.a(pendingconnection); } catch (IOException ioexception) { - a.warning("DSCT: " + ioexception.getMessage()); // CraftBukkit + this.e.d().getLogger().warning("DSCT: " + ioexception.getMessage()); // CraftBukkit } } - System.out.println("Closing listening thread"); + this.e.d().getLogger().info("Closing listening thread"); } private void a(PendingConnection pendingconnection) { if (pendingconnection == null) { throw new IllegalArgumentException("Got null pendingconnection!"); } else { - List list = this.b; + List list = this.a; - synchronized (this.b) { - this.b.add(pendingconnection); + synchronized (this.a) { + this.a.add(pendingconnection); } } } @@ -112,17 +109,17 @@ public class DedicatedServerConnectionThread extends Thread { public void a(InetAddress inetaddress) { if (inetaddress != null) { - HashMap hashmap = this.c; + HashMap hashmap = this.b; - synchronized (this.c) { - this.c.remove(inetaddress); + synchronized (this.b) { + this.b.remove(inetaddress); } } } public void b() { try { - this.e.close(); + this.d.close(); } catch (Throwable throwable) { ; } |