Skip to content

Commit

Permalink
Merge pull request #53 from miniduikboot/fix/usedtls-desync
Browse files Browse the repository at this point in the history
  • Loading branch information
js6pak authored Mar 9, 2022
2 parents e58f8b5 + 9b1211f commit bbcb1ab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Reactor/Networking/Patches/ClientPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReactorPlugin>.Info($"Currently using dtls: {useDtlsLayout}. Should use dtls: {AmongUsClient.Instance.useDtls}");
useDtlsLayout = AmongUsClient.Instance.useDtls;
}

public static void Postfix(ref Il2CppStructArray<byte> __result)
{
ModList.Update();
Expand Down

0 comments on commit bbcb1ab

Please sign in to comment.