1diff --git a/thirdparty/enet/enet/enet.h b/thirdparty/enet/enet/enet.h 2index 54d91b5603..24d36647d9 100644 3--- a/thirdparty/enet/enet/enet.h 4+++ b/thirdparty/enet/enet/enet.h 5@@ -10,13 +10,19 @@ extern "C" 6 { 7 #endif 8 9+#include <stdint.h> 10 #include <stdlib.h> 11 12+// -- Godot start -- 13+#if 0 14 #ifdef _WIN32 15 #include "enet/win32.h" 16 #else 17 #include "enet/unix.h" 18 #endif 19+#endif 20+#include "enet/godot.h" 21+// -- Godot end -- 22 23 #include "enet/types.h" 24 #include "enet/protocol.h" 25@@ -86,11 +92,15 @@ typedef enum _ENetSocketShutdown 26 * but not for enet_host_create. Once a server responds to a broadcast, the 27 * address is updated from ENET_HOST_BROADCAST to the server's actual IP address. 28 */ 29+// -- Godot start -- 30+#if 0 31 typedef struct _ENetAddress 32 { 33 enet_uint32 host; 34 enet_uint16 port; 35 } ENetAddress; 36+#endif 37+// -- Godot end -- 38 39 /** 40 * Packet flag bit constants. 41@@ -606,6 +616,10 @@ ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t, 42 43 extern size_t enet_protocol_command_size (enet_uint8); 44 45+// -- Godot start -- 46+#include "enet/godot_ext.h" 47+// -- Godot end -- 48+ 49 #ifdef __cplusplus 50 } 51 #endif 52diff --git a/thirdparty/enet/host.c b/thirdparty/enet/host.c 53index 3be6c0922c..fc4da4ca67 100644 54--- a/thirdparty/enet/host.c 55+++ b/thirdparty/enet/host.c 56@@ -87,7 +87,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelL 57 host -> commandCount = 0; 58 host -> bufferCount = 0; 59 host -> checksum = NULL; 60- host -> receivedAddress.host = ENET_HOST_ANY; 61+ memset(host -> receivedAddress.host, 0, 16); 62 host -> receivedAddress.port = 0; 63 host -> receivedData = NULL; 64 host -> receivedDataLength = 0; 65diff --git a/thirdparty/enet/protocol.c b/thirdparty/enet/protocol.c 66index 0a60253173..fefc0e6f0a 100644 67--- a/thirdparty/enet/protocol.c 68+++ b/thirdparty/enet/protocol.c 69@@ -307,7 +307,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet 70 } 71 else 72 if (currentPeer -> state != ENET_PEER_STATE_CONNECTING && 73- currentPeer -> address.host == host -> receivedAddress.host) 74+ enet_host_equal(currentPeer -> address.host, host -> receivedAddress.host)) 75 { 76 if (currentPeer -> address.port == host -> receivedAddress.port && 77 currentPeer -> connectID == command -> connect.connectID) 78@@ -1027,9 +1027,8 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) 79 80 if (peer -> state == ENET_PEER_STATE_DISCONNECTED || 81 peer -> state == ENET_PEER_STATE_ZOMBIE || 82- ((host -> receivedAddress.host != peer -> address.host || 83- host -> receivedAddress.port != peer -> address.port) && 84- peer -> address.host != ENET_HOST_BROADCAST) || 85+ (!enet_host_equal(host -> receivedAddress.host, peer -> address.host) || 86+ host -> receivedAddress.port != peer -> address.port) || 87 (peer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID && 88 sessionID != peer -> incomingSessionID)) 89 return 0; 90@@ -1071,7 +1070,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) 91 92 if (peer != NULL) 93 { 94- peer -> address.host = host -> receivedAddress.host; 95+ enet_address_set_ip(&(peer -> address), host -> receivedAddress.host, 16); 96 peer -> address.port = host -> receivedAddress.port; 97 peer -> incomingDataTotal += host -> receivedDataLength; 98 } 99