blob: 75985a3c0aef33ef663620da002127ee1db457a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
package net.minecraft.server;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
class NetworkAcceptThread extends Thread {
final MinecraftServer a;
final NetworkListenThread listenThread;
long connectionThrottle; // CraftBukkit
NetworkAcceptThread(NetworkListenThread networklistenthread, String s, MinecraftServer minecraftserver) {
super(s);
this.listenThread = networklistenthread;
this.a = minecraftserver;
}
public void run() {
while (this.listenThread.b) {
try {
Socket socket = NetworkListenThread.a(this.listenThread).accept();
if (socket != null) {
synchronized (NetworkListenThread.getRecentConnectionAttempts(this.listenThread)) {
InetAddress inetaddress = socket.getInetAddress();
// CraftBukkit start
if (this.a.server == null) {
socket.close();
continue;
}
connectionThrottle = this.a.server.getConnectionThrottle();
// CraftBukkit end
// CraftBukkit
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;
}
NetworkListenThread.getRecentConnectionAttempts(this.listenThread).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
}
NetLoginHandler netloginhandler = new NetLoginHandler(this.a, socket, "Connection #" + NetworkListenThread.c(this.listenThread));
NetworkListenThread.a(this.listenThread, netloginhandler);
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
}
}
}
}
|