2020-01-05 19:05:42 +01:00
|
|
|
diff --git a/thirdparty/enet/enet/enet.h b/thirdparty/enet/enet/enet.h
|
2024-04-05 10:12:29 +02:00
|
|
|
index 4a207041b3..5232f8a869 100644
|
2020-01-05 19:05:42 +01:00
|
|
|
--- a/thirdparty/enet/enet/enet.h
|
|
|
|
+++ b/thirdparty/enet/enet/enet.h
|
2020-07-13 19:35:57 +02:00
|
|
|
@@ -10,13 +10,19 @@ extern "C"
|
2020-01-05 19:05:42 +01:00
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2020-07-13 19:35:57 +02:00
|
|
|
+// -- Godot start --
|
|
|
|
+#if 0
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include "enet/win32.h"
|
|
|
|
#else
|
|
|
|
#include "enet/unix.h"
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-01-05 19:05:42 +01:00
|
|
|
+#include "enet/godot.h"
|
2020-07-13 19:35:57 +02:00
|
|
|
+// -- Godot end --
|
2020-01-05 19:05:42 +01:00
|
|
|
|
|
|
|
#include "enet/types.h"
|
|
|
|
#include "enet/protocol.h"
|
2024-04-05 10:12:29 +02:00
|
|
|
@@ -87,11 +93,15 @@ typedef enum _ENetSocketShutdown
|
2020-07-13 19:35:57 +02:00
|
|
|
* but not for enet_host_create. Once a server responds to a broadcast, the
|
|
|
|
* address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
|
2020-01-05 19:05:42 +01:00
|
|
|
*/
|
2020-07-13 19:35:57 +02:00
|
|
|
+// -- Godot start --
|
|
|
|
+#if 0
|
2020-01-05 19:05:42 +01:00
|
|
|
typedef struct _ENetAddress
|
|
|
|
{
|
2020-07-13 19:35:57 +02:00
|
|
|
enet_uint32 host;
|
2020-01-05 19:05:42 +01:00
|
|
|
enet_uint16 port;
|
|
|
|
} ENetAddress;
|
2020-07-13 19:35:57 +02:00
|
|
|
+#endif
|
|
|
|
+// -- Godot end --
|
2020-01-05 19:05:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Packet flag bit constants.
|
2024-04-05 10:12:29 +02:00
|
|
|
@@ -608,6 +618,10 @@ ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t,
|
2020-07-13 19:35:57 +02:00
|
|
|
|
|
|
|
extern size_t enet_protocol_command_size (enet_uint8);
|
2020-01-05 19:05:42 +01:00
|
|
|
|
2020-07-13 19:35:57 +02:00
|
|
|
+// -- Godot start --
|
|
|
|
+#include "enet/godot_ext.h"
|
|
|
|
+// -- Godot end --
|
2020-01-05 19:05:42 +01:00
|
|
|
+
|
2020-07-13 19:35:57 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2020-01-05 19:05:42 +01:00
|
|
|
diff --git a/thirdparty/enet/host.c b/thirdparty/enet/host.c
|
2024-04-05 10:12:29 +02:00
|
|
|
index fff946a392..adb3533cf1 100644
|
2020-01-05 19:05:42 +01:00
|
|
|
--- a/thirdparty/enet/host.c
|
|
|
|
+++ b/thirdparty/enet/host.c
|
|
|
|
@@ -87,7 +87,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL
|
|
|
|
host -> commandCount = 0;
|
|
|
|
host -> bufferCount = 0;
|
|
|
|
host -> checksum = NULL;
|
|
|
|
- host -> receivedAddress.host = ENET_HOST_ANY;
|
|
|
|
+ memset(host -> receivedAddress.host, 0, 16);
|
|
|
|
host -> receivedAddress.port = 0;
|
|
|
|
host -> receivedData = NULL;
|
|
|
|
host -> receivedDataLength = 0;
|
|
|
|
diff --git a/thirdparty/enet/protocol.c b/thirdparty/enet/protocol.c
|
2024-04-05 10:12:29 +02:00
|
|
|
index 843a719af3..5f18700599 100644
|
2020-01-05 19:05:42 +01:00
|
|
|
--- a/thirdparty/enet/protocol.c
|
|
|
|
+++ b/thirdparty/enet/protocol.c
|
2024-04-05 10:12:29 +02:00
|
|
|
@@ -318,7 +318,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
|
2020-01-05 19:05:42 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
if (currentPeer -> state != ENET_PEER_STATE_CONNECTING &&
|
|
|
|
- currentPeer -> address.host == host -> receivedAddress.host)
|
|
|
|
+ enet_host_equal(currentPeer -> address.host, host -> receivedAddress.host))
|
|
|
|
{
|
|
|
|
if (currentPeer -> address.port == host -> receivedAddress.port &&
|
|
|
|
currentPeer -> connectID == command -> connect.connectID)
|
2024-04-05 10:12:29 +02:00
|
|
|
@@ -1043,9 +1043,8 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
|
2020-01-05 19:05:42 +01:00
|
|
|
|
|
|
|
if (peer -> state == ENET_PEER_STATE_DISCONNECTED ||
|
|
|
|
peer -> state == ENET_PEER_STATE_ZOMBIE ||
|
|
|
|
- ((host -> receivedAddress.host != peer -> address.host ||
|
|
|
|
- host -> receivedAddress.port != peer -> address.port) &&
|
|
|
|
- peer -> address.host != ENET_HOST_BROADCAST) ||
|
|
|
|
+ (!enet_host_equal(host -> receivedAddress.host, peer -> address.host) ||
|
|
|
|
+ host -> receivedAddress.port != peer -> address.port) ||
|
|
|
|
(peer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID &&
|
|
|
|
sessionID != peer -> incomingSessionID))
|
|
|
|
return 0;
|
2024-04-05 10:12:29 +02:00
|
|
|
@@ -1090,7 +1089,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
|
2020-01-05 19:05:42 +01:00
|
|
|
|
|
|
|
if (peer != NULL)
|
|
|
|
{
|
|
|
|
- peer -> address.host = host -> receivedAddress.host;
|
|
|
|
+ enet_address_set_ip(&(peer -> address), host -> receivedAddress.host, 16);
|
|
|
|
peer -> address.port = host -> receivedAddress.port;
|
|
|
|
peer -> incomingDataTotal += host -> receivedDataLength;
|
|
|
|
}
|