From c35f4614454c0fae7fd118c8f2cfc6160106a2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 5 Jan 2020 19:19:56 +0100 Subject: [PATCH] enet: Sync with upstream 1.3.14 We still have local modifications necessary for IPv6 support and using Godot sockets. --- thirdparty/README.md | 2 +- thirdparty/enet/LICENSE | 2 +- thirdparty/enet/enet/enet.h | 13 ++++++++++++- thirdparty/enet/protocol.c | 16 +++++++++++++--- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/thirdparty/README.md b/thirdparty/README.md index 91fbe7d396..f75cc645ea 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -46,7 +46,7 @@ Files extracted from upstream source: ## enet - Upstream: http://enet.bespin.org -- Version: 1.3.13 (f46fee0, 2016) +- Version: 1.3.14 (0eaf48e, 2019) - License: MIT Files extracted from upstream source: 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/protocol.c b/thirdparty/enet/protocol.c index ab26886de4..28ad5fc41c 100644 --- a/thirdparty/enet/protocol.c +++ b/thirdparty/enet/protocol.c @@ -163,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); @@ -182,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 @@ -1405,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); }