Alter last to force conflicts but keep contents

This commit is contained in:
Zach Brown 2016-11-26 22:02:19 -06:00
parent 324acd64b4
commit 8c27c1fd27
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76
1 changed files with 68 additions and 39 deletions

View File

@ -1,11 +1,11 @@
From d2374b6257ad5d1aa24289572ec3f6ef21006759 Mon Sep 17 00:00:00 2001 From 1036c659ccd24bb427ba7f560a0a2428c823db7f Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com> From: Alfie Cleveland <alfeh@me.com>
Date: Fri, 25 Nov 2016 20:35:05 +0000 Date: Fri, 25 Nov 2016 20:35:05 +0000
Subject: [PATCH] Optimise NetworkManager Subject: [PATCH] Optimise NetworkManager
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 184ef32..cca3237 100644 index 184ef32..be14c0b 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java --- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -62,8 +62,8 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -62,8 +62,8 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -19,24 +19,30 @@ index 184ef32..cca3237 100644
public Channel channel; public Channel channel;
// Spigot Start // PAIL // Spigot Start // PAIL
public SocketAddress l; public SocketAddress l;
@@ -141,7 +141,9 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -141,32 +141,36 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
if (this.isConnected()) { if (this.isConnected()) {
this.m(); this.m();
this.a(packet, (GenericFutureListener[]) null); this.a(packet, (GenericFutureListener[]) null);
- } else { - } else {
+ } - this.j.writeLock().lock();
+ // Paper start
+ /* else {
this.j.writeLock().lock();
try {
@@ -149,15 +151,18 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
} finally {
this.j.writeLock().unlock();
}
- }
- -
+ }*/ - try {
- this.i.add(new NetworkManager.QueuedPacket(packet, (GenericFutureListener[]) null));
- } finally {
- this.j.writeLock().unlock();
- }
}
-
+ // Paper start - Remove but force a conflict
+// else {
+// this.j.writeLock().lock();
+//
+// try {
+// this.i.add(new NetworkManager.QueuedPacket(packet, (GenericFutureListener[]) null));
+// } finally {
+// this.j.writeLock().unlock();
+// }
+// }
+ // Paper end + // Paper end
} }
@ -45,44 +51,67 @@ index 184ef32..cca3237 100644
this.m(); this.m();
this.a(packet, (GenericFutureListener[]) ArrayUtils.add(agenericfuturelistener, 0, genericfuturelistener)); this.a(packet, (GenericFutureListener[]) ArrayUtils.add(agenericfuturelistener, 0, genericfuturelistener));
- } else { - } else {
+ } - this.j.writeLock().lock();
+ // Paper start -
+ /* - try {
+ else { - this.i.add(new NetworkManager.QueuedPacket(packet, (GenericFutureListener[]) ArrayUtils.add(agenericfuturelistener, 0, genericfuturelistener)));
this.j.writeLock().lock(); - } finally {
- this.j.writeLock().unlock();
try { - }
@@ -166,7 +171,8 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
this.j.writeLock().unlock();
}
} }
- -
+ */ + // Paper start - Remove but force a conflict
+// else {
+// this.j.writeLock().lock();
+//
+// try {
+// this.i.add(new NetworkManager.QueuedPacket(packet, (GenericFutureListener[]) ArrayUtils.add(agenericfuturelistener, 0, genericfuturelistener)));
+// } finally {
+// this.j.writeLock().unlock();
+// }
+// }
+ // Paper end + // Paper end
} }
private void a(final Packet<?> packet, @Nullable final GenericFutureListener<? extends Future<? super Void>>[] agenericfuturelistener) { private void a(final Packet<?> packet, @Nullable final GenericFutureListener<? extends Future<? super Void>>[] agenericfuturelistener) {
@@ -211,7 +217,8 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -211,20 +215,22 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
} }
private void m() { private void m() {
- if (this.channel != null && this.channel.isOpen()) { - if (this.channel != null && this.channel.isOpen()) {
+ // Paper start - this.j.readLock().lock();
+ /* if (this.channel != null && this.channel.isOpen()) { -
this.j.readLock().lock(); - try {
- while (!this.i.isEmpty()) {
try { - NetworkManager.QueuedPacket networkmanager_queuedpacket = (NetworkManager.QueuedPacket) this.i.poll();
@@ -224,7 +231,8 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { -
this.j.readLock().unlock(); - this.a(networkmanager_queuedpacket.a, networkmanager_queuedpacket.b);
} - }
- } finally {
- this.j.readLock().unlock();
- }
-
- } - }
+ }*/ + // Paper start - Remove but force a conflict
+// if (this.channel != null && this.channel.isOpen()) {
+// this.j.readLock().lock();
+//
+// try {
+// while (!this.i.isEmpty()) {
+// NetworkManager.QueuedPacket networkmanager_queuedpacket = (NetworkManager.QueuedPacket) this.i.poll();
+//
+// this.a(networkmanager_queuedpacket.a, networkmanager_queuedpacket.b);
+// }
+// } finally {
+// this.j.readLock().unlock();
+// }
+//
+// }
+ // Paper end + // Paper end
} }
public void a() { public void a() {
@@ -317,7 +325,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -317,7 +323,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
} else if (this.i() != null) { } else if (this.i() != null) {
this.i().a(new ChatComponentText("Disconnected")); this.i().a(new ChatComponentText("Disconnected"));
} }
@ -92,5 +121,5 @@ index 184ef32..cca3237 100644
} }
-- --
2.9.3 (Apple Git-75) 2.10.2