Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-06 00:00:47 +01:00
Flush consolidation
Dieser Commit ist enthalten in:
Ursprung
e3c75a7fcc
Commit
195a506117
@ -3,12 +3,14 @@ package com.velocitypowered.proxy.connection.backend;
|
|||||||
import static com.velocitypowered.proxy.VelocityServer.GSON;
|
import static com.velocitypowered.proxy.VelocityServer.GSON;
|
||||||
import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants.HANDSHAKE_HOSTNAME_TOKEN;
|
import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants.HANDSHAKE_HOSTNAME_TOKEN;
|
||||||
import static com.velocitypowered.proxy.network.Connections.FLOW_HANDLER;
|
import static com.velocitypowered.proxy.network.Connections.FLOW_HANDLER;
|
||||||
|
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION;
|
||||||
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
|
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
|
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.HANDLER;
|
import static com.velocitypowered.proxy.network.Connections.HANDLER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
|
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
|
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
|
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
|
||||||
|
import static io.netty.handler.flush.FlushConsolidationHandler.DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.velocitypowered.api.network.ProtocolVersion;
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
@ -37,6 +39,7 @@ import io.netty.channel.Channel;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.handler.flow.FlowControlHandler;
|
import io.netty.handler.flow.FlowControlHandler;
|
||||||
|
import io.netty.handler.flush.FlushConsolidationHandler;
|
||||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -90,7 +93,9 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
|
|||||||
.addLast(MINECRAFT_DECODER,
|
.addLast(MINECRAFT_DECODER,
|
||||||
new MinecraftDecoder(ProtocolUtils.Direction.CLIENTBOUND))
|
new MinecraftDecoder(ProtocolUtils.Direction.CLIENTBOUND))
|
||||||
.addLast(MINECRAFT_ENCODER,
|
.addLast(MINECRAFT_ENCODER,
|
||||||
new MinecraftEncoder(ProtocolUtils.Direction.SERVERBOUND));
|
new MinecraftEncoder(ProtocolUtils.Direction.SERVERBOUND))
|
||||||
|
.addLast(FLUSH_CONSOLIDATION, new FlushConsolidationHandler(
|
||||||
|
DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES, true));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.connect(registeredServer.getServerInfo().getAddress())
|
.connect(registeredServer.getServerInfo().getAddress())
|
||||||
|
@ -15,6 +15,7 @@ public class Connections {
|
|||||||
public static final String MINECRAFT_DECODER = "minecraft-decoder";
|
public static final String MINECRAFT_DECODER = "minecraft-decoder";
|
||||||
public static final String MINECRAFT_ENCODER = "minecraft-encoder";
|
public static final String MINECRAFT_ENCODER = "minecraft-encoder";
|
||||||
public static final String READ_TIMEOUT = "read-timeout";
|
public static final String READ_TIMEOUT = "read-timeout";
|
||||||
|
public static final String FLUSH_CONSOLIDATION = "flush-consolidation";
|
||||||
|
|
||||||
private Connections() {
|
private Connections() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.velocitypowered.proxy.network;
|
package com.velocitypowered.proxy.network;
|
||||||
|
|
||||||
|
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION;
|
||||||
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
|
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
|
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_DECODER;
|
import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_DECODER;
|
||||||
@ -7,6 +8,7 @@ import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_ENCODER;
|
|||||||
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
|
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
|
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
|
||||||
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
|
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
|
||||||
|
import static io.netty.handler.flush.FlushConsolidationHandler.DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES;
|
||||||
|
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||||
@ -22,6 +24,7 @@ import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.handler.codec.haproxy.HAProxyMessageDecoder;
|
import io.netty.handler.codec.haproxy.HAProxyMessageDecoder;
|
||||||
|
import io.netty.handler.flush.FlushConsolidationHandler;
|
||||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -45,7 +48,9 @@ public class ServerChannelInitializer extends ChannelInitializer<Channel> {
|
|||||||
.addLast(LEGACY_PING_ENCODER, LegacyPingEncoder.INSTANCE)
|
.addLast(LEGACY_PING_ENCODER, LegacyPingEncoder.INSTANCE)
|
||||||
.addLast(FRAME_ENCODER, MinecraftVarintLengthEncoder.INSTANCE)
|
.addLast(FRAME_ENCODER, MinecraftVarintLengthEncoder.INSTANCE)
|
||||||
.addLast(MINECRAFT_DECODER, new MinecraftDecoder(ProtocolUtils.Direction.SERVERBOUND))
|
.addLast(MINECRAFT_DECODER, new MinecraftDecoder(ProtocolUtils.Direction.SERVERBOUND))
|
||||||
.addLast(MINECRAFT_ENCODER, new MinecraftEncoder(ProtocolUtils.Direction.CLIENTBOUND));
|
.addLast(MINECRAFT_ENCODER, new MinecraftEncoder(ProtocolUtils.Direction.CLIENTBOUND))
|
||||||
|
.addLast(FLUSH_CONSOLIDATION, new FlushConsolidationHandler(
|
||||||
|
DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES, true));
|
||||||
|
|
||||||
final MinecraftConnection connection = new MinecraftConnection(ch, this.server);
|
final MinecraftConnection connection = new MinecraftConnection(ch, this.server);
|
||||||
connection.setSessionHandler(new HandshakeSessionHandler(connection, this.server));
|
connection.setSessionHandler(new HandshakeSessionHandler(connection, this.server));
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren