2019-04-23 10:09:26 +02:00
|
|
|
From 80a9e6ef520f65949b77f5809f561cc018a1f571 Mon Sep 17 00:00:00 2001
|
2016-05-28 18:34:39 +02:00
|
|
|
From: Techcable <Techcable@outlook.com>
|
|
|
|
Date: Sun, 7 Feb 2016 00:01:19 -0700
|
|
|
|
Subject: [PATCH] Add a property to accept invalid ping packets
|
|
|
|
|
|
|
|
This is disabled by default, as I don't wanna accept invalid packets
|
|
|
|
You can enable it by setting '-Dwaterfall.acceptInvalidPackets=true' at the command line
|
|
|
|
|
|
|
|
Fixes #23
|
|
|
|
|
|
|
|
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
|
2019-04-23 10:09:26 +02:00
|
|
|
index 4731cb9d..6a193d6f 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
2019-04-23 10:09:26 +02:00
|
|
|
@@ -261,10 +261,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
2016-05-28 18:34:39 +02:00
|
|
|
thisState = State.PING;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ private static final boolean ACCEPT_INVALID_PACKETS = Boolean.parseBoolean(System.getProperty("waterfall.acceptInvalidPackets", "false"));
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public void handle(PingPacket ping) throws Exception
|
|
|
|
{
|
|
|
|
- Preconditions.checkState( thisState == State.PING, "Not expecting PING" );
|
|
|
|
+ if (!ACCEPT_INVALID_PACKETS) {
|
|
|
|
+ Preconditions.checkState(thisState == State.PING, "Not expecting PING");
|
|
|
|
+ }
|
|
|
|
unsafe.sendPacket( ping );
|
|
|
|
disconnect( "" );
|
|
|
|
}
|
|
|
|
--
|
2019-04-23 10:09:26 +02:00
|
|
|
2.21.0
|
2016-05-28 18:34:39 +02:00
|
|
|
|