mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-01-29 19:11:47 +01:00
Revert exception changes
This commit is contained in:
parent
9697ae9cf3
commit
5f2d4e8b6d
@ -1,4 +1,4 @@
|
||||
From b59b64610c3cafc27f28602efd104477760cde45 Mon Sep 17 00:00:00 2001
|
||||
From 38e24dcc8b058115653bc7bf79cd81a75a058b92 Mon Sep 17 00:00:00 2001
|
||||
From: Juan Cruz Linsalata <LinsaFTW@users.noreply.github.com>
|
||||
Date: Mon, 12 Oct 2020 15:40:53 -0300
|
||||
Subject: [PATCH] FlameCord General Patch
|
||||
@ -593,7 +593,7 @@ index 5d3857060..83d3e9edd 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
||||
index 7b99c466d..2c94ef554 100644
|
||||
index 7b99c466d..522bd93da 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
||||
@@ -1,6 +1,8 @@
|
||||
@ -605,21 +605,12 @@ index 7b99c466d..2c94ef554 100644
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -34,6 +36,7 @@ import net.md_5.bungee.netty.ChannelWrapper;
|
||||
import net.md_5.bungee.netty.HandlerBoss;
|
||||
import net.md_5.bungee.netty.PacketHandler;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
+import net.md_5.bungee.protocol.BadPacketException;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.MinecraftDecoder;
|
||||
import net.md_5.bungee.protocol.PacketWrapper;
|
||||
@@ -163,7 +166,8 @@ public class ServerConnector extends PacketHandler
|
||||
@@ -163,7 +165,7 @@ public class ServerConnector extends PacketHandler
|
||||
{
|
||||
if ( packet.packet == null )
|
||||
{
|
||||
- throw new QuietException( "Unexpected packet received during server login process!\n" + BufUtil.dump( packet.buf, 16 ) );
|
||||
+ // FlameCord - Change from QuietException to BadPacketException
|
||||
+ throw new BadPacketException( "Unexpected packet received during server connector process!\n" + BufUtil.dump(packet.buf, 16) );
|
||||
+ throw new QuietException( "Unexpected packet received during server connector process!\n" + BufUtil.dump(packet.buf, 16) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,7 +649,7 @@ index 159119c13..7c4c8f8a0 100644
|
||||
b.connect().addListener( listener );
|
||||
}
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
index e7542b1c1..18bab507a 100644
|
||||
index e7542b1c1..deee607dc 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
@@ -16,6 +16,8 @@ import java.util.logging.Level;
|
||||
@ -670,38 +661,28 @@ index e7542b1c1..18bab507a 100644
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
@@ -49,6 +51,7 @@ import net.md_5.bungee.netty.PacketHandler;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
import net.md_5.bungee.netty.cipher.CipherDecoder;
|
||||
import net.md_5.bungee.netty.cipher.CipherEncoder;
|
||||
+import net.md_5.bungee.protocol.BadPacketException;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.PacketWrapper;
|
||||
import net.md_5.bungee.protocol.Protocol;
|
||||
@@ -152,7 +155,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
@@ -152,7 +154,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
{
|
||||
if ( packet.packet == null )
|
||||
{
|
||||
- throw new QuietException( "Unexpected packet received during login process! " + BufUtil.dump( packet.buf, 16 ) );
|
||||
+ // FlameCord - Change from QuietException to BadPacketException
|
||||
+ throw new BadPacketException( "Unexpected packet received during server login process!\n" + BufUtil.dump(packet.buf, 16) );
|
||||
+ throw new QuietException( "Unexpected packet received during server login process!\n" + BufUtil.dump(packet.buf, 16) );
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java
|
||||
index 6cd71071e..24195ed1b 100644
|
||||
index 6cd71071e..cf73d1f0a 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java
|
||||
@@ -1,6 +1,8 @@
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.md_5.bungee.connection;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
+
|
||||
+import dev._2lstudios.flamecord.FlameCord;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
@@ -12,6 +14,7 @@ import net.md_5.bungee.api.config.ServerInfo;
|
||||
@@ -12,6 +13,7 @@ import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.netty.ChannelWrapper;
|
||||
import net.md_5.bungee.netty.PacketHandler;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
@ -709,16 +690,6 @@ index 6cd71071e..24195ed1b 100644
|
||||
import net.md_5.bungee.protocol.MinecraftDecoder;
|
||||
import net.md_5.bungee.protocol.MinecraftEncoder;
|
||||
import net.md_5.bungee.protocol.PacketWrapper;
|
||||
@@ -58,7 +61,8 @@ public class PingHandler extends PacketHandler
|
||||
{
|
||||
if ( packet.packet == null )
|
||||
{
|
||||
- throw new QuietException( "Unexpected packet received during ping process! " + BufUtil.dump( packet.buf, 16 ) );
|
||||
+ // FlameCord - Change from QuietException to BadPacketException
|
||||
+ throw new BadPacketException( "Unexpected packet received during ping process! " + BufUtil.dump( packet.buf, 16 ) );
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
|
||||
index b8e508552..7f18b5646 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
|
||||
|
@ -1,14 +1,14 @@
|
||||
From 3a3b9229d496e28f0194ccffdf5bb3b0cf4079ea Mon Sep 17 00:00:00 2001
|
||||
From be41c59b3d676632710f10a1c88d655e12cbf48c Mon Sep 17 00:00:00 2001
|
||||
From: linsaftw <linsaftw@users.noreply.github.com>
|
||||
Date: Sat, 20 Mar 2021 12:36:25 -0300
|
||||
Subject: [PATCH] Fix ByteBuf memory leaks
|
||||
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
||||
index 2c94ef55..3646cb95 100644
|
||||
index 522bd93da..494375cd6 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
|
||||
@@ -286,9 +286,15 @@ public class ServerConnector extends PacketHandler
|
||||
@@ -284,9 +284,15 @@ public class ServerConnector extends PacketHandler
|
||||
} else
|
||||
{
|
||||
ByteBuf brand = ByteBufAllocator.DEFAULT.heapBuffer();
|
||||
@ -28,7 +28,7 @@ index 2c94ef55..3646cb95 100644
|
||||
// Travertine end
|
||||
}
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
|
||||
index 474551d3..8716d0c8 100644
|
||||
index 474551d3e..8716d0c85 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
|
||||
@@ -294,12 +294,21 @@ public class DownstreamBridge extends PacketHandler
|
||||
@ -60,7 +60,7 @@ index 474551d3..8716d0c8 100644
|
||||
{
|
||||
return;
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
index a3a12e19..214a1fd0 100644
|
||||
index a3a12e19b..214a1fd04 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
@@ -143,11 +143,17 @@ public abstract class EntityMap
|
||||
@ -87,7 +87,7 @@ index a3a12e19..214a1fd0 100644
|
||||
}
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_6.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_6.java
|
||||
index 6755fe84..21871d14 100644
|
||||
index 6755fe845..21871d14a 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_6.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_6.java
|
||||
@@ -39,19 +39,27 @@ class EntityMap_1_7_6 extends EntityMap_1_7_2
|
||||
@ -130,7 +130,7 @@ index 6755fe84..21871d14 100644
|
||||
}
|
||||
}
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/forge/ForgeUtils.java b/proxy/src/main/java/net/md_5/bungee/forge/ForgeUtils.java
|
||||
index cefa0206..2cd5740c 100644
|
||||
index cefa0206e..2cd5740ca 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/forge/ForgeUtils.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/forge/ForgeUtils.java
|
||||
@@ -38,15 +38,27 @@ public class ForgeUtils
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 4e2cb9724d144d7d0257716b50984d7fd164535d Mon Sep 17 00:00:00 2001
|
||||
From 461598fbaeb1eb72a065b1b5a5c518682600c824 Mon Sep 17 00:00:00 2001
|
||||
From: linsaftw <25271111+linsaftw@users.noreply.github.com>
|
||||
Date: Fri, 30 Apr 2021 23:51:51 -0300
|
||||
Subject: [PATCH] FlameCord logger options
|
||||
@ -38,10 +38,10 @@ index 8bb61ac11..8822c6d33 100644
|
||||
this.firewallNotify = setIfUnexistant("firewall.notify", this.firewallNotify, configuration);
|
||||
this.firewallSeconds = setIfUnexistant("firewall.seconds", this.firewallSeconds, configuration);
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
index 18bab507a..86869e5b4 100644
|
||||
index deee607dc..3182f0144 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
@@ -369,7 +369,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
@@ -367,7 +367,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
{
|
||||
case 1:
|
||||
// Ping
|
||||
@ -51,7 +51,7 @@ index 18bab507a..86869e5b4 100644
|
||||
{
|
||||
bungee.getLogger().log( Level.INFO, "{0} has pinged", this );
|
||||
}
|
||||
@@ -378,7 +379,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
@@ -376,7 +377,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
break;
|
||||
case 2:
|
||||
// Login
|
||||
|
@ -1,134 +0,0 @@
|
||||
From 4e2cb9724d144d7d0257716b50984d7fd164535d Mon Sep 17 00:00:00 2001
|
||||
From: linsaftw <25271111+linsaftw@users.noreply.github.com>
|
||||
Date: Fri, 30 Apr 2021 23:51:51 -0300
|
||||
Subject: [PATCH] FlameCord logger options
|
||||
|
||||
|
||||
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
||||
index 8bb61ac11..8822c6d33 100644
|
||||
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
||||
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
|
||||
@@ -12,6 +12,15 @@ import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
|
||||
public class FlameCordConfiguration {
|
||||
+ @Getter
|
||||
+ private boolean loggerInitialhandler = false;
|
||||
+ @Getter
|
||||
+ private boolean loggerExceptions = false;
|
||||
+ @Getter
|
||||
+ private boolean loggerDump = false;
|
||||
+ @Getter
|
||||
+ private boolean loggerHaProxy = false;
|
||||
+
|
||||
@Getter
|
||||
private boolean firewallNotify = true;
|
||||
@Getter
|
||||
@@ -34,6 +43,12 @@ public class FlameCordConfiguration {
|
||||
configuration = configurationProvider.load(configurationFile);
|
||||
}
|
||||
|
||||
+ this.loggerInitialhandler = setIfUnexistant("logger.initialhandler", this.loggerInitialhandler,
|
||||
+ configuration);
|
||||
+ this.loggerExceptions = setIfUnexistant("logger.exceptions", this.loggerExceptions, configuration);
|
||||
+ this.loggerDump = setIfUnexistant("logger.dump", this.loggerDump, configuration);
|
||||
+ this.loggerHaProxy = setIfUnexistant("logger.haproxy", this.loggerHaProxy, configuration);
|
||||
+
|
||||
this.firewallEnabled = setIfUnexistant("firewall.enabled", this.firewallEnabled, configuration);
|
||||
this.firewallNotify = setIfUnexistant("firewall.notify", this.firewallNotify, configuration);
|
||||
this.firewallSeconds = setIfUnexistant("firewall.seconds", this.firewallSeconds, configuration);
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
index 18bab507a..86869e5b4 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
||||
@@ -369,7 +369,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
{
|
||||
case 1:
|
||||
// Ping
|
||||
- if ( bungee.getConfig().isLogPings() )
|
||||
+ // FlameCord - Option to log initialhandler
|
||||
+ if ( bungee.getConfig().isLogPings() && FlameCord.getInstance().getFlameCordConfiguration().isLoggerInitialhandler() )
|
||||
{
|
||||
bungee.getLogger().log( Level.INFO, "{0} has pinged", this );
|
||||
}
|
||||
@@ -378,7 +379,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
break;
|
||||
case 2:
|
||||
// Login
|
||||
- if (BungeeCord.getInstance().getConfig().isLogInitialHandlerConnections() ) // Waterfall
|
||||
+ // FlameCord - Option to log initialhandler
|
||||
+ if (BungeeCord.getInstance().getConfig().isLogInitialHandlerConnections() && FlameCord.getInstance().getFlameCordConfiguration().isLoggerInitialhandler() ) // Waterfall
|
||||
{
|
||||
bungee.getLogger().log( Level.INFO, "{0} has connected", this );
|
||||
}
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
|
||||
index 5de0414ec..9f70323ee 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
|
||||
@@ -48,7 +48,8 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
||||
channel = new ChannelWrapper( ctx );
|
||||
handler.connected( channel );
|
||||
|
||||
- if ( !( handler instanceof InitialHandler || handler instanceof PingHandler ) )
|
||||
+ // FlameCord - Option to log initialhandler
|
||||
+ if ( !( handler instanceof InitialHandler || handler instanceof PingHandler ) && FlameCord.getInstance().getFlameCordConfiguration().isLoggerInitialhandler() )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has connected", handler );
|
||||
}
|
||||
@@ -64,7 +65,8 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
||||
channel.close();
|
||||
handler.disconnected( channel );
|
||||
|
||||
- if ( !( handler instanceof InitialHandler || handler instanceof PingHandler ) )
|
||||
+ // FlameCord - Option to log initialhandler
|
||||
+ if ( !( handler instanceof InitialHandler || handler instanceof PingHandler ) && FlameCord.getInstance().getFlameCordConfiguration().isLoggerInitialhandler() )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
|
||||
}
|
||||
@@ -95,10 +97,13 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
||||
{
|
||||
InetSocketAddress newAddress = new InetSocketAddress( proxy.sourceAddress(), proxy.sourcePort() );
|
||||
|
||||
- ProxyServer.getInstance().getLogger().log( Level.FINE, "Set remote address via PROXY {0} -> {1}", new Object[]
|
||||
- {
|
||||
- channel.getRemoteAddress(), newAddress
|
||||
- } );
|
||||
+ // FlameCord - Option to log haproxy
|
||||
+ if ( FlameCord.getInstance().getFlameCordConfiguration().isLoggerHaProxy() ) {
|
||||
+ ProxyServer.getInstance().getLogger().log( Level.FINE, "Set remote address via PROXY {0} -> {1}", new Object[]
|
||||
+ {
|
||||
+ channel.getRemoteAddress(), newAddress
|
||||
+ } );
|
||||
+ }
|
||||
|
||||
channel.setRemoteAddress( newAddress );
|
||||
} finally
|
||||
@@ -142,6 +147,9 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
||||
{
|
||||
boolean logExceptions = !( handler instanceof PingHandler );
|
||||
|
||||
+ // FlameCord - Option to log exceptions
|
||||
+ logExceptions = FlameCord.getInstance().getFlameCordConfiguration().isLoggerExceptions() ? logExceptions : false;
|
||||
+
|
||||
// FlameCord - Don't log firewall exceptions
|
||||
logExceptions = cause instanceof FirewallException ? false : logExceptions;
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
|
||||
index 81987ca39..8808a989c 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
|
||||
@@ -115,7 +115,10 @@ public class PipelineUtils
|
||||
// FlameCord - Close on exception caught
|
||||
@Override
|
||||
public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception {
|
||||
- cause.printStackTrace();
|
||||
+ // FlameCord - Option to log exceptions
|
||||
+ if (FlameCord.getInstance().getFlameCordConfiguration().isLoggerExceptions()) {
|
||||
+ cause.printStackTrace();
|
||||
+ }
|
||||
|
||||
ctx.close();
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
Loading…
Reference in New Issue
Block a user