diff --git a/Source/Managed/ENet.cs b/Source/Managed/ENet.cs index bff8e4f..2c242b3 100644 --- a/Source/Managed/ENet.cs +++ b/Source/Managed/ENet.cs @@ -2,7 +2,7 @@ * Managed C# wrapper for an extended version of ENet * This is a fork from upstream and is available at http://github.com/SoftwareGuy/ENet-CSharp * - * Copyright (c) 2019 Matt Coburn (SoftwareGuy/Coburn64), Chris Burns (c6burns) + * Copyright (c) 2019-2021 Matt Coburn (SoftwareGuy/Coburn64), Chris Burns (c6burns) * Copyright (c) 2013 James Bellinger, 2016 Nate Shoffner, 2018 Stanislav Denisov * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -1128,7 +1128,7 @@ public static class Library public const uint timeoutLimit = 32; public const uint timeoutMinimum = 5000; public const uint timeoutMaximum = 30000; - public const uint version = (2 << 16) | (4 << 8) | (6); + public const uint version = (2 << 16) | (4 << 8) | (7); public static uint Time { @@ -1141,7 +1141,7 @@ public static uint Time public static bool Initialize() { if (Native.enet_linked_version() != version) - throw new InvalidOperationException("You're trying to use an incompatible version of ENet with this Managed Library."); + throw new throw new InvalidOperationException("ENet native is out of date. Download the latest release from https://github.com/SoftwareGuy/ENet-CSharp/releases"); return Native.enet_initialize() == 0; } @@ -1152,7 +1152,7 @@ public static bool Initialize(Callbacks callbacks) throw new ArgumentNullException("callbacks"); if (Native.enet_linked_version() != version) - throw new InvalidOperationException("Incompatatible version"); + throw new InvalidOperationException("ENet native is out of date. Download the latest release from https://github.com/SoftwareGuy/ENet-CSharp/releases"); ENetCallbacks nativeCallbacks = callbacks.NativeData; diff --git a/Source/Native/enet.h b/Source/Native/enet.h index b7d6966..8f20d3a 100644 --- a/Source/Native/enet.h +++ b/Source/Native/enet.h @@ -32,7 +32,7 @@ #define ENET_VERSION_MAJOR 2 #define ENET_VERSION_MINOR 4 -#define ENET_VERSION_PATCH 6 +#define ENET_VERSION_PATCH 7 #define ENET_VERSION_CREATE(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) #define ENET_VERSION_GET_MAJOR(version) (((version) >> 16) & 0xFF) #define ENET_VERSION_GET_MINOR(version) (((version) >> 8) & 0xFF) @@ -2921,7 +2921,10 @@ static int enet_protocol_send_outgoing_commands(ENetHost* host, ENetEvent* event host->commandCount = 0; host->bufferCount = 1; host->packetSize = sizeof(ENetProtocolHeader); - + + if (host->checksumCallback != NULL) + host->packetSize += sizeof(enet_checksum); + if (!enet_list_empty(¤tPeer->acknowledgements)) enet_protocol_send_acknowledgements(host, currentPeer); @@ -3156,7 +3159,7 @@ int enet_peer_send(ENetPeer* peer, uint8_t channelID, ENetPacket* packet) { return -1; } - fragmentLength = peer->mtu - sizeof(ENetProtocolHeader) - sizeof(ENetProtocolSendFragment); + fragmentLength = peer->mtu - sizeof(ENetProtocolHeader) - sizeof(ENetProtocolSendFragment) - sizeof(ENetProtocolAcknowledge); if (peer->host->checksumCallback != NULL) fragmentLength -= sizeof(enet_checksum);