Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Small cleanup in closeWith
Dieser Commit ist enthalten in:
Ursprung
005c12fb0f
Commit
6b26daa281
@ -225,13 +225,13 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
|
|||||||
public void closeWith(Object msg) {
|
public void closeWith(Object msg) {
|
||||||
if (channel.isActive()) {
|
if (channel.isActive()) {
|
||||||
boolean is1Point8 = this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0;
|
boolean is1Point8 = this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0;
|
||||||
boolean isLegacyPing = this.getState() == StateRegistry.HANDSHAKE
|
boolean isLegacyOrPing = this.getState() == StateRegistry.HANDSHAKE
|
||||||
|| this.getState() == StateRegistry.STATUS;
|
|| this.getState() == StateRegistry.STATUS;
|
||||||
if (channel.eventLoop().inEventLoop() && (is1Point8 || isLegacyPing)) {
|
if (channel.eventLoop().inEventLoop() && (is1Point8 || isLegacyOrPing)) {
|
||||||
knownDisconnect = true;
|
knownDisconnect = true;
|
||||||
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE);
|
||||||
} else {
|
} else {
|
||||||
// 1.7.x versions have a race condition with switching protocol versions, so just explicitly
|
// 1.7.x versions have a race condition with switching protocol states, so just explicitly
|
||||||
// close the connection after a short while.
|
// close the connection after a short while.
|
||||||
this.setAutoReading(false);
|
this.setAutoReading(false);
|
||||||
channel.eventLoop().schedule(() -> {
|
channel.eventLoop().schedule(() -> {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren