Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-29 09:30:08 +01:00
Make pipeline fail-safe limit changeable
☠
Dieser Commit ist enthalten in:
Ursprung
1ea548f05d
Commit
a0a229fa29
@ -58,6 +58,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class ProtocolRegistry {
|
public class ProtocolRegistry {
|
||||||
public static final Protocol BASE_PROTOCOL = new BaseProtocol();
|
public static final Protocol BASE_PROTOCOL = new BaseProtocol();
|
||||||
public static int SERVER_PROTOCOL = -1;
|
public static int SERVER_PROTOCOL = -1;
|
||||||
|
public static int maxProtocolPathSize = 50;
|
||||||
// Input Version -> Output Version & Protocol (Allows fast lookup)
|
// Input Version -> Output Version & Protocol (Allows fast lookup)
|
||||||
private static final Int2ObjectMap<Int2ObjectMap<Protocol>> registryMap = new Int2ObjectOpenHashMap<>(32);
|
private static final Int2ObjectMap<Int2ObjectMap<Protocol>> registryMap = new Int2ObjectOpenHashMap<>(32);
|
||||||
private static final Map<Class<? extends Protocol>, Protocol> protocols = new HashMap<>();
|
private static final Map<Class<? extends Protocol>, Protocol> protocols = new HashMap<>();
|
||||||
@ -242,7 +243,7 @@ public class ProtocolRegistry {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private static List<Pair<Integer, Protocol>> getProtocolPath(List<Pair<Integer, Protocol>> current, int clientVersion, int serverVersion) {
|
private static List<Pair<Integer, Protocol>> getProtocolPath(List<Pair<Integer, Protocol>> current, int clientVersion, int serverVersion) {
|
||||||
if (clientVersion == serverVersion) return null; // We're already there
|
if (clientVersion == serverVersion) return null; // We're already there
|
||||||
if (current.size() > 50) return null; // Fail safe, protocol too complicated.
|
if (current.size() > maxProtocolPathSize) return null; // Fail safe, protocol too complicated.
|
||||||
|
|
||||||
// First check if there is any protocols for this
|
// First check if there is any protocols for this
|
||||||
Int2ObjectMap<Protocol> inputMap = registryMap.get(clientVersion);
|
Int2ObjectMap<Protocol> inputMap = registryMap.get(clientVersion);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren