initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
92
thirdparty/enet/patches/0001-godot-socket.patch
vendored
Normal file
92
thirdparty/enet/patches/0001-godot-socket.patch
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
diff --git a/thirdparty/enet/enet/enet.h b/thirdparty/enet/enet/enet.h
|
||||
index 3001018763..ccd8382c23 100644
|
||||
--- a/thirdparty/enet/enet/enet.h
|
||||
+++ b/thirdparty/enet/enet/enet.h
|
||||
@@ -10,13 +10,17 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
+#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
+#if 0
|
||||
#ifdef _WIN32
|
||||
#include "enet/win32.h"
|
||||
#else
|
||||
#include "enet/unix.h"
|
||||
#endif
|
||||
+#endif
|
||||
+#include "enet/enet_godot.h"
|
||||
|
||||
#include "enet/types.h"
|
||||
#include "enet/protocol.h"
|
||||
@@ -87,11 +91,13 @@ typedef enum _ENetSocketShutdown
|
||||
* 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.
|
||||
*/
|
||||
+#if 0
|
||||
typedef struct _ENetAddress
|
||||
{
|
||||
enet_uint32 host;
|
||||
enet_uint16 port;
|
||||
} ENetAddress;
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* Packet flag bit constants.
|
||||
@@ -608,6 +614,8 @@ ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t,
|
||||
|
||||
extern size_t enet_protocol_command_size (enet_uint8);
|
||||
|
||||
+#include "enet/enet_godot_ext.h"
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
diff --git a/thirdparty/enet/host.c b/thirdparty/enet/host.c
|
||||
index fff946a392..adb3533cf1 100644
|
||||
--- 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
|
||||
index 843a719af3..5f18700599 100644
|
||||
--- a/thirdparty/enet/protocol.c
|
||||
+++ b/thirdparty/enet/protocol.c
|
||||
@@ -318,7 +318,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
|
||||
}
|
||||
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)
|
||||
@@ -1043,9 +1043,8 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
|
||||
|
||||
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;
|
||||
@@ -1090,7 +1089,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
|
||||
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user