Improved packet handling
Dieser Commit ist enthalten in:
Ursprung
1784e42d5f
Commit
9ec5d8b5df
@ -105,7 +105,8 @@ public class NetworkManager {
|
|||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.z-- <= 0 && !this.o.isEmpty() && (this.f == 0 || System.currentTimeMillis() - ((Packet) this.o.get(0)).timestamp >= (long) this.f)) {
|
// CraftBukkit - add 'flag'
|
||||||
|
if ((!flag || this.z-- <= 0) && !this.o.isEmpty() && (this.f == 0 || System.currentTimeMillis() - ((Packet) this.o.get(0)).timestamp >= (long) this.f)) {
|
||||||
object = this.g;
|
object = this.g;
|
||||||
synchronized (this.g) {
|
synchronized (this.g) {
|
||||||
packet = (Packet) this.o.remove(0);
|
packet = (Packet) this.o.remove(0);
|
||||||
|
@ -69,6 +69,11 @@ public abstract class Packet {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// CraftBukkit start - sleep while nothing to do
|
||||||
|
while(datainputstream.available() <= 0) {
|
||||||
|
Thread.sleep(10);
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
i = datainputstream.read();
|
i = datainputstream.read();
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
return null;
|
return null;
|
||||||
@ -97,6 +102,10 @@ public abstract class Packet {
|
|||||||
System.out.println("Connection reset");
|
System.out.println("Connection reset");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
catch (InterruptedException exception) {
|
||||||
|
System.out.println("Thread exception");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
PacketCounter packetcounter = (PacketCounter) e.get(Integer.valueOf(i));
|
PacketCounter packetcounter = (PacketCounter) e.get(Integer.valueOf(i));
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren