(1.2.4) Fixed UnsupportedOperationException in EaglerXBungee

This commit is contained in:
lax1dude 2024-06-03 18:45:54 -07:00
parent e58e9bcb5d
commit 8ffd102664
6 changed files with 42 additions and 23 deletions

View File

@ -108,6 +108,14 @@ public class EaglerMinecraftDecoder extends MessageToMessageDecoder<WebSocketFra
} }
private PacketWrapper wrapPacket(DefinedPacket packet, ByteBuf buf, Protocol protocol) { private PacketWrapper wrapPacket(DefinedPacket packet, ByteBuf buf, Protocol protocol) {
boolean isInputDirect = buf.isDirect();
if(!isInputDirect) {
int len = buf.readableBytes();
ByteBuf newBuf = buf.alloc().directBuffer(len, len);
buf.readBytes(newBuf, len);
buf = newBuf;
}
try {
PacketWrapper pkt; PacketWrapper pkt;
if (packetWrapperConstructor != null) { if (packetWrapperConstructor != null) {
try { try {
@ -133,5 +141,10 @@ public class EaglerMinecraftDecoder extends MessageToMessageDecoder<WebSocketFra
throw new RuntimeException(var13); throw new RuntimeException(var13);
} }
} }
}finally {
if(!isInputDirect) {
buf.release();
}
}
} }
} }

View File

@ -45,6 +45,7 @@ public class EaglerUpdateSvc {
private static final List<ClientCertificateHolder> certs = new ArrayList(); private static final List<ClientCertificateHolder> certs = new ArrayList();
private static final Map<String,CachedClientCertificate> certsCache = new HashMap(); private static final Map<String,CachedClientCertificate> certsCache = new HashMap();
private static final Set<String> deadURLS = new HashSet();
private static class CachedClientCertificate { private static class CachedClientCertificate {
private final ClientCertificateHolder cert; private final ClientCertificateHolder cert;
@ -110,6 +111,8 @@ public class EaglerUpdateSvc {
if(code / 100 != 2) { if(code / 100 != 2) {
con.disconnect(); con.disconnect();
throw new IOException("Response code was " + code); throw new IOException("Response code was " + code);
}else {
deadURLS.remove(str);
} }
ByteArrayOutputStream bao = new ByteArrayOutputStream(32767); ByteArrayOutputStream bao = new ByteArrayOutputStream(32767);
try(InputStream is = con.getInputStream()) { try(InputStream is = con.getInputStream()) {
@ -140,10 +143,12 @@ public class EaglerUpdateSvc {
} }
log.info("Downloading new certificate: " + str); log.info("Downloading new certificate: " + str);
}catch(Throwable t) { }catch(Throwable t) {
if(deadURLS.add(str)) {
log.severe("Failed to download certificate: " + str); log.severe("Failed to download certificate: " + str);
log.severe("Reason: " + t.toString()); log.severe("Reason: " + t.toString());
} }
} }
}
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
File[] dirList = eagcert.listFiles(); File[] dirList = eagcert.listFiles();
for(int i = 0; i < dirList.length; ++i) { for(int i = 0; i < dirList.length; ++i) {

View File

@ -815,7 +815,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
EaglerXBungee.logger().info("[" + ctx.channel().remoteAddress() + "]: Logged in as '" + usernameStr + "'"); EaglerXBungee.logger().info("[" + ctx.channel().remoteAddress() + "]: Logged in as '" + usernameStr + "'");
final UserConnection userCon = eaglerCon.userConnection = new UserConnection(bungee, ch, usernameStr, initialHandler); final UserConnection userCon = new UserConnection(bungee, ch, usernameStr, initialHandler);
userCon.setCompressionThreshold(-1); userCon.setCompressionThreshold(-1);
try { try {
if (!userCon.init()) { if (!userCon.init()) {
@ -991,6 +991,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
Callback<PostLoginEvent> complete = new Callback<PostLoginEvent>() { Callback<PostLoginEvent> complete = new Callback<PostLoginEvent>() {
@Override @Override
public void done(PostLoginEvent result, Throwable error) { public void done(PostLoginEvent result, Throwable error) {
eaglerCon.userConnection = userCon;
eaglerCon.hasBeenForwarded = true; eaglerCon.hasBeenForwarded = true;
if (ch.isClosed()) { if (ch.isClosed()) {
return; return;

View File

@ -1,5 +1,5 @@
name: EaglercraftXBungee name: EaglercraftXBungee
main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee
version: 1.2.3 version: 1.2.4
description: Plugin to allow EaglercraftX 1.8 players to join your network, or allow EaglercraftX 1.8 players to use your network as a proxy to join other networks description: Plugin to allow EaglercraftX 1.8 players to join your network, or allow EaglercraftX 1.8 players to use your network as a proxy to join other networks
author: lax1dude author: lax1dude

View File

@ -1 +1 @@
1.2.3 1.2.4