Skip to content

Commit

Permalink
Fast track upstream 2.4.7
Browse files Browse the repository at this point in the history
...and change some texts about it being outdated
  • Loading branch information
SoftwareGuy committed Apr 15, 2021
1 parent 80079c2 commit dd97d94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Source/Managed/ENet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand All @@ -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;
}
Expand All @@ -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;

Expand Down
9 changes: 6 additions & 3 deletions Source/Native/enet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(&currentPeer->acknowledgements))
enet_protocol_send_acknowledgements(host, currentPeer);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit dd97d94

Please sign in to comment.