mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-10-06 05:37:39 +02:00
Fixed deadlocking issues with packet syncing
This commit is contained in:
parent
7fe4e9fc52
commit
657c4b402b
@ -262,7 +262,7 @@ public class Client2ProxyHandler extends SimpleChannelInboundHandler<IPacket> {
|
|||||||
this.proxyConnection.getChannel().writeAndFlush(haProxyMessage).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
this.proxyConnection.getChannel().writeAndFlush(haProxyMessage).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.proxyConnection.getChannel().writeAndFlush(new C2SHandshakePacket(clientVersion.getOriginalVersion(), serverAddress.getAddress(), serverAddress.getPort(), packet.intendedState)).await().addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
this.proxyConnection.getChannel().writeAndFlush(new C2SHandshakePacket(clientVersion.getOriginalVersion(), serverAddress.getAddress(), serverAddress.getPort(), packet.intendedState)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE).await();
|
||||||
this.proxyConnection.setConnectionState(packet.intendedState);
|
this.proxyConnection.setConnectionState(packet.intendedState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,19 +135,31 @@ public class Proxy2ServerHandler extends SimpleChannelInboundHandler<IPacket> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLoginSuccess(final S2CLoginSuccessPacket1_7 packet) throws Exception {
|
private void handleLoginSuccess(final S2CLoginSuccessPacket1_7 packet) {
|
||||||
|
if(true) throw new RuntimeException("test");
|
||||||
|
|
||||||
if (this.proxyConnection.getClientVersion().isNewerThanOrEqualTo(VersionEnum.r1_8)) {
|
if (this.proxyConnection.getClientVersion().isNewerThanOrEqualTo(VersionEnum.r1_8)) {
|
||||||
if (Options.COMPRESSION_THRESHOLD > -1 && this.proxyConnection.getC2P().attr(MCPipeline.COMPRESSION_THRESHOLD_ATTRIBUTE_KEY).get() == -1) {
|
if (Options.COMPRESSION_THRESHOLD > -1 && this.proxyConnection.getC2P().attr(MCPipeline.COMPRESSION_THRESHOLD_ATTRIBUTE_KEY).get() == -1) {
|
||||||
this.proxyConnection.getC2P().writeAndFlush(new S2CLoginCompressionPacket(Options.COMPRESSION_THRESHOLD)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE).await();
|
this.proxyConnection.getC2P().writeAndFlush(new S2CLoginCompressionPacket(Options.COMPRESSION_THRESHOLD)).addListeners(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE, (ChannelFutureListener) f -> {
|
||||||
this.proxyConnection.getC2P().attr(MCPipeline.COMPRESSION_THRESHOLD_ATTRIBUTE_KEY).set(Options.COMPRESSION_THRESHOLD);
|
if (f.isSuccess()) {
|
||||||
|
this.proxyConnection.getC2P().attr(MCPipeline.COMPRESSION_THRESHOLD_ATTRIBUTE_KEY).set(Options.COMPRESSION_THRESHOLD);
|
||||||
|
this.proxyConnection.getChannel().config().setAutoRead(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.proxyConnection.getChannel().config().setAutoRead(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.proxyConnection.setGameProfile(new GameProfile(packet.uuid, packet.name));
|
this.proxyConnection.setGameProfile(new GameProfile(packet.uuid, packet.name));
|
||||||
|
|
||||||
Logger.u_info("connect", this.proxyConnection.getC2P().remoteAddress(), this.proxyConnection.getGameProfile(), "Connected successfully! Switching to PLAY state");
|
Logger.u_info("connect", this.proxyConnection.getC2P().remoteAddress(), this.proxyConnection.getGameProfile(), "Connected successfully! Switching to PLAY state");
|
||||||
this.proxyConnection.getC2P().writeAndFlush(packet).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE).await();
|
this.proxyConnection.getC2P().writeAndFlush(packet).addListeners(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE, (ChannelFutureListener) f -> {
|
||||||
this.proxyConnection.setConnectionState(ConnectionState.PLAY);
|
if (f.isSuccess()) {
|
||||||
|
this.proxyConnection.setConnectionState(ConnectionState.PLAY);
|
||||||
|
this.proxyConnection.getChannel().config().setAutoRead(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.proxyConnection.getChannel().config().setAutoRead(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLoginCompression(final S2CLoginCompressionPacket packet) {
|
private void handleLoginCompression(final S2CLoginCompressionPacket packet) {
|
||||||
|
@ -237,7 +237,7 @@ public class ProxyConnection extends NetClient {
|
|||||||
return this.classicMpPass;
|
return this.classicMpPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void kickClient(final String message) throws InterruptedException, CloseAndReturn {
|
public void kickClient(final String message) throws CloseAndReturn {
|
||||||
Logger.u_err("kick", this.c2p.remoteAddress(), this.getGameProfile(), message.replaceAll("§.", ""));
|
Logger.u_err("kick", this.c2p.remoteAddress(), this.getGameProfile(), message.replaceAll("§.", ""));
|
||||||
|
|
||||||
final ChannelFuture future;
|
final ChannelFuture future;
|
||||||
@ -254,7 +254,7 @@ public class ProxyConnection extends NetClient {
|
|||||||
future = this.c2p.newSucceededFuture();
|
future = this.c2p.newSucceededFuture();
|
||||||
}
|
}
|
||||||
|
|
||||||
future.await().channel().close();
|
future.channel().close();
|
||||||
throw CloseAndReturn.INSTANCE;
|
throw CloseAndReturn.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user