diff --git a/Reactor/Networking/Patches/ClientPatches.cs b/Reactor/Networking/Patches/ClientPatches.cs index ed84649..7c5bc74 100644 --- a/Reactor/Networking/Patches/ClientPatches.cs +++ b/Reactor/Networking/Patches/ClientPatches.cs @@ -154,6 +154,15 @@ private static IEnumerator Coroutine(UdpConnection connection) [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.GetConnectionData))] public static class HandshakePatch { + public static void Prefix(ref bool useDtlsLayout) + { + // Due to reasons currently unknown, the useDtlsLayout parameter sometimes doesn't reflect whether DTLS + // is actually supposed to be enabled. This causes a bad handshake message and a quick disconnect. + // The field on AmongUsClient appears to be more reliable, so override this parameter with what it is supposed to be. + Logger.Info($"Currently using dtls: {useDtlsLayout}. Should use dtls: {AmongUsClient.Instance.useDtls}"); + useDtlsLayout = AmongUsClient.Instance.useDtls; + } + public static void Postfix(ref Il2CppStructArray __result) { ModList.Update();