3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Suppress some really annoying spam

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-06-23 07:56:19 -04:00
Ursprung 9dda0ba9dd
Commit df82c0b566

Datei anzeigen

@ -205,19 +205,32 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
*/ */
public void closeWith(Object msg) { public void closeWith(Object msg) {
if (channel.isActive()) { if (channel.isActive()) {
if (channel.eventLoop().inEventLoop()) {
knownDisconnect = true;
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
} else {
channel.eventLoop().execute(() -> { channel.eventLoop().execute(() -> {
knownDisconnect = true; knownDisconnect = true;
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE); channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
}); });
} }
} }
}
/** /**
* Immediately closes the connection. * Immediately closes the connection.
*/ */
public void close() { public void close() {
if (channel.isActive()) { if (channel.isActive()) {
if (channel.eventLoop().inEventLoop()) {
knownDisconnect = true;
channel.close(); channel.close();
} else {
channel.eventLoop().execute(() -> {
knownDisconnect = true;
channel.close();
});
}
} }
} }