mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-14 19:15:08 -05:00
Fixed proxy connect race condition
This commit is contained in:
parent
be14bbf6f4
commit
57d1af5427
2 changed files with 2 additions and 5 deletions
|
@ -279,15 +279,14 @@ public class Client2ProxyHandler extends SimpleChannelInboundHandler<IPacket> {
|
|||
|
||||
this.proxyConnection.getChannel().writeAndFlush(newHandshakePacket).addListeners(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE, (ChannelFutureListener) f2 -> {
|
||||
if (f2.isSuccess()) {
|
||||
this.proxyConnection.setP2sConnectionState(intendedState.getConnectionState());
|
||||
final UserConnection userConnection = this.proxyConnection.getUserConnection();
|
||||
if (userConnection.has(CookieStorage.class) && TransferDataHolder.hasCookieStorage(this.proxyConnection.getC2P())) {
|
||||
userConnection.get(CookieStorage.class).cookies().putAll(TransferDataHolder.removeCookieStorage(this.proxyConnection.getC2P()).cookies());
|
||||
}
|
||||
this.proxyConnection.setP2sConnectionState(intendedState.getConnectionState());
|
||||
ChannelUtil.restoreAutoRead(this.proxyConnection.getC2P());
|
||||
}
|
||||
});
|
||||
|
||||
ChannelUtil.restoreAutoRead(this.proxyConnection.getC2P());
|
||||
});
|
||||
}
|
||||
}, (ThrowingChannelFutureListener) f -> {
|
||||
|
|
|
@ -25,7 +25,6 @@ import net.raphimc.viaproxy.ViaProxy;
|
|||
import net.raphimc.viaproxy.proxy.session.ProxyConnection;
|
||||
import net.raphimc.viaproxy.util.logging.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
|
||||
|
@ -45,7 +44,6 @@ public class ExceptionUtil {
|
|||
public static void handleNettyException(ChannelHandlerContext ctx, Throwable cause, ProxyConnection proxyConnection, boolean client2Proxy) {
|
||||
if (!ctx.channel().isOpen()) return;
|
||||
if (cause instanceof ClosedChannelException) return;
|
||||
if (cause instanceof IOException) return;
|
||||
if (cause instanceof CloseAndReturn) {
|
||||
ctx.channel().close();
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue