Better treat the disconnect flag

This commit is contained in:
Sotr
2019-03-18 19:33:49 +08:00
parent 4c793d5cd4
commit 66c2886ded

View File

@@ -21,7 +21,6 @@ import io.netty.util.concurrent.GenericFutureListener;
import java.net.SocketAddress;
import java.util.Iterator;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.annotation.Nullable;
import javax.crypto.SecretKey;
@@ -59,7 +58,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
private PacketListener packetListener;
private IChatBaseComponent n;
private boolean o;
private AtomicBoolean p = new AtomicBoolean(false); // Akarin
private volatile boolean p; // Akarin - add volatile
private int q;
private int r;
private float s;
@@ -444,10 +443,10 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
public void handleDisconnection() {
if (this.channel != null && !this.channel.isOpen()) {
if (!this.p.compareAndSet(false, true)) { // Akarin
if (this.p) {
NetworkManager.g.warn("handleDisconnection() called twice");
} else {
// this.p = true; // Akarin
this.p = true;
if (this.j() != null) {
this.i().a(this.j());
} else if (this.i() != null) {