diff options
Diffstat (limited to 'thirdparty/enet')
-rw-r--r-- | thirdparty/enet/LICENSE | 2 | ||||
-rw-r--r-- | thirdparty/enet/enet/enet.h | 13 | ||||
-rw-r--r-- | thirdparty/enet/enet/godot.h | 4 | ||||
-rw-r--r-- | thirdparty/enet/godot.cpp | 4 | ||||
-rw-r--r-- | thirdparty/enet/patches/ipv6_support.patch | 105 | ||||
-rw-r--r-- | thirdparty/enet/protocol.c | 19 |
6 files changed, 136 insertions, 11 deletions
diff --git a/thirdparty/enet/LICENSE b/thirdparty/enet/LICENSE index 39af84a8f6..78d9dcf613 100644 --- a/thirdparty/enet/LICENSE +++ b/thirdparty/enet/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2002-2016 Lee Salzman +Copyright (c) 2002-2019 Lee Salzman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/thirdparty/enet/enet/enet.h b/thirdparty/enet/enet/enet.h index 246cbb0a62..966e3a465d 100644 --- a/thirdparty/enet/enet/enet.h +++ b/thirdparty/enet/enet/enet.h @@ -22,7 +22,7 @@ extern "C" #define ENET_VERSION_MAJOR 1 #define ENET_VERSION_MINOR 3 -#define ENET_VERSION_PATCH 13 +#define ENET_VERSION_PATCH 14 #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) @@ -507,6 +507,17 @@ ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSock /** @defgroup Address ENet address functions @{ */ + +/** Attempts to parse the printable form of the IP address in the parameter hostName + and sets the host field in the address parameter if successful. + @param address destination to store the parsed IP address + @param hostName IP address to parse + @retval 0 on success + @retval < 0 on failure + @returns the address of the given hostName in address on success +*/ +ENET_API int enet_address_set_host_ip (ENetAddress * address, const char * hostName); + /** Attempts to resolve the host named by the parameter hostName and sets the host field in the address parameter if successful. @param address destination to store resolved address diff --git a/thirdparty/enet/enet/godot.h b/thirdparty/enet/enet/godot.h index 9230af428b..4f25ea9c7b 100644 --- a/thirdparty/enet/enet/godot.h +++ b/thirdparty/enet/enet/godot.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index 822a294781..63580b6d1a 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/thirdparty/enet/patches/ipv6_support.patch b/thirdparty/enet/patches/ipv6_support.patch new file mode 100644 index 0000000000..1f79863645 --- /dev/null +++ b/thirdparty/enet/patches/ipv6_support.patch @@ -0,0 +1,105 @@ +diff --git a/thirdparty/enet/enet/enet.h b/thirdparty/enet/enet/enet.h +index 650b199ee5..246cbb0a62 100644 +--- a/thirdparty/enet/enet/enet.h ++++ b/thirdparty/enet/enet/enet.h +@@ -10,13 +10,10 @@ extern "C" + { + #endif + ++#include <stdint.h> + #include <stdlib.h> + +-#ifdef _WIN32 +-#include "enet/win32.h" +-#else +-#include "enet/unix.h" +-#endif ++#include "enet/godot.h" + + #include "enet/types.h" + #include "enet/protocol.h" +@@ -72,7 +69,6 @@ typedef enum _ENetSocketShutdown + ENET_SOCKET_SHUTDOWN_READ_WRITE = 2 + } ENetSocketShutdown; + +-#define ENET_HOST_ANY 0 + #define ENET_HOST_BROADCAST 0xFFFFFFFFU + #define ENET_PORT_ANY 0 + +@@ -88,9 +84,11 @@ typedef enum _ENetSocketShutdown + */ + typedef struct _ENetAddress + { +- enet_uint32 host; ++ uint8_t host[16]; + enet_uint16 port; ++ uint8_t wildcard; + } ENetAddress; ++#define enet_host_equal(host_a, host_b) (memcmp(&host_a, &host_b,16) == 0) + + /** + * Packet flag bit constants. +@@ -519,6 +517,16 @@ ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSock + */ + ENET_API int enet_address_set_host (ENetAddress * address, const char * hostName); + ++/** Sets the host field in the address parameter from ip struct. ++ @param address destination to store resolved address ++ @param ip the ip struct to read from ++ @param size the size of the ip struct. ++ @retval 0 on success ++ @retval != 0 on failure ++ @returns the address of the given ip in address on success. ++*/ ++ENET_API void enet_address_set_ip(ENetAddress * address, const uint8_t * ip, size_t size); ++ + /** Gives the printable form of the IP address specified in the address parameter. + @param address address printed + @param hostName destination for name, must not be NULL +diff --git a/thirdparty/enet/host.c b/thirdparty/enet/host.c +index 3be6c0922c..fc4da4ca67 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 29d648732d..ab26886de4 100644 +--- a/thirdparty/enet/protocol.c ++++ b/thirdparty/enet/protocol.c +@@ -298,7 +298,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) +@@ -1010,9 +1010,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; +@@ -1054,7 +1053,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; + } diff --git a/thirdparty/enet/protocol.c b/thirdparty/enet/protocol.c index cbeea1a763..28ad5fc41c 100644 --- a/thirdparty/enet/protocol.c +++ b/thirdparty/enet/protocol.c @@ -9,7 +9,6 @@ #include "enet/time.h" #include "enet/enet.h" - static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] = { 0, @@ -164,7 +163,10 @@ enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer) { ENetOutgoingCommand * outgoingCommand; - while (! enet_list_empty (& peer -> sentUnreliableCommands)) + if (enet_list_empty (& peer -> sentUnreliableCommands)) + return; + + do { outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands); @@ -183,7 +185,13 @@ enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer) } enet_free (outgoingCommand); - } + } while (! enet_list_empty (& peer -> sentUnreliableCommands)); + + if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER && + enet_list_empty (& peer -> outgoingReliableCommands) && + enet_list_empty (& peer -> outgoingUnreliableCommands) && + enet_list_empty (& peer -> sentReliableCommands)) + enet_peer_disconnect (peer, peer -> eventData); } static ENetProtocolCommand @@ -1406,7 +1414,8 @@ enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * pee if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER && enet_list_empty (& peer -> outgoingReliableCommands) && enet_list_empty (& peer -> outgoingUnreliableCommands) && - enet_list_empty (& peer -> sentReliableCommands)) + enet_list_empty (& peer -> sentReliableCommands) && + enet_list_empty (& peer -> sentUnreliableCommands)) enet_peer_disconnect (peer, peer -> eventData); } @@ -1691,7 +1700,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch & host -> buffers [1], host -> bufferCount - 1, originalSize, host -> packetData [1], - originalSize); + originalSize); if (compressedSize > 0 && compressedSize < originalSize) { host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_COMPRESSED; |