Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 04:50:06 +01:00
Redid packet prioritisation to fix chunk loss bug encountered when teleporting, also addresses issues caused by teleport fixes.
Dieser Commit ist enthalten in:
Ursprung
cb9c7d1b2a
Commit
ad95bf4095
@ -93,32 +93,39 @@ public class NetworkManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Object object;
|
Object object;
|
||||||
Packet packet = null; // CraftBukkit
|
Packet packet;
|
||||||
int i;
|
int i;
|
||||||
int[] aint;
|
int[] aint;
|
||||||
|
|
||||||
// CraftBukkit start - thread safety and prioitizing packets in this.n (high prioirty queue) over those in this.o (low priority queue).
|
if (!this.n.isEmpty() && (this.f == 0 || System.currentTimeMillis() - ((Packet) this.n.get(0)).timestamp >= (long) this.f)) {
|
||||||
object = this.g;
|
object = this.g;
|
||||||
synchronized (this.g) {
|
synchronized (this.g) {
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
if (!this.n.isEmpty() && (this.f == 0 || time - ((Packet) this.n.get(0)).timestamp >= (long) this.f)) {
|
|
||||||
packet = (Packet) this.n.remove(0);
|
packet = (Packet) this.n.remove(0);
|
||||||
this.x -= packet.a() + 1;
|
this.x -= packet.a() + 1;
|
||||||
} else if (this.y-- <= 0 && !this.o.isEmpty() && (this.f == 0 || time - ((Packet) this.o.get(0)).timestamp >= (long) this.f)) {
|
|
||||||
packet = (Packet) this.o.remove(0);
|
|
||||||
this.x -= packet.a() + 1;
|
|
||||||
this.y = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet != null) {
|
|
||||||
Packet.a(packet, this.output);
|
Packet.a(packet, this.output);
|
||||||
aint = e;
|
aint = e;
|
||||||
i = packet.b();
|
i = packet.b();
|
||||||
aint[i] += packet.a() + 1;
|
aint[i] += packet.a() + 1;
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
|
||||||
|
// CraftBukkit - don't allow low priority packet to be sent unless it was placed in the queue before the first packet on the high priority queue
|
||||||
|
if ((flag || this.y-- <= 0) && !this.o.isEmpty() && (this.n.isEmpty() || ((Packet) this.n.get(0)).timestamp > ((Packet) this.o.get(0)).timestamp)) {
|
||||||
|
object = this.g;
|
||||||
|
synchronized (this.g) {
|
||||||
|
packet = (Packet) this.o.remove(0);
|
||||||
|
this.x -= packet.a() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Packet.a(packet, this.output);
|
||||||
|
aint = e;
|
||||||
|
i = packet.b();
|
||||||
|
aint[i] += packet.a() + 1;
|
||||||
|
this.y = 0;
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
return flag;
|
return flag;
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren