diff --git a/polymer/eduke32/source/enet/include/enet/enet.h b/polymer/eduke32/source/enet/include/enet/enet.h index a8c7c548b..b2c57529b 100644 --- a/polymer/eduke32/source/enet/include/enet/enet.h +++ b/polymer/eduke32/source/enet/include/enet/enet.h @@ -29,7 +29,7 @@ extern "C" #define ENET_VERSION_MAJOR 1 #define ENET_VERSION_MINOR 3 -#define ENET_VERSION_PATCH 11 +#define ENET_VERSION_PATCH 13 #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) diff --git a/polymer/eduke32/source/enet/src/protocol.c b/polymer/eduke32/source/enet/src/protocol.c index fd153bfd4..fbeb4fc74 100644 --- a/polymer/eduke32/source/enet/src/protocol.c +++ b/polymer/eduke32/source/enet/src/protocol.c @@ -771,6 +771,10 @@ enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const EN if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0) peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + else + if (peer -> incomingBandwidth == 0 || host -> outgoingBandwidth == 0) + peer -> windowSize = (ENET_MAX (peer -> incomingBandwidth, host -> outgoingBandwidth) / + ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; else peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) / ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; @@ -1200,7 +1204,9 @@ commandError: static int enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event) { - for (;;) + int packets; + + for (packets = 0; packets < 256; ++ packets) { int receivedLength; ENetBuffer buffer; @@ -1493,7 +1499,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) && (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE || channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) | - (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow))))) + (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOWS - reliableWindow))))) windowWrap = 1; if (windowWrap) { diff --git a/polymer/eduke32/source/enet/src/unix.c b/polymer/eduke32/source/enet/src/unix.c index 904249978..36943893d 100644 --- a/polymer/eduke32/source/enet/src/unix.c +++ b/polymer/eduke32/source/enet/src/unix.c @@ -107,7 +107,7 @@ enet_address_set_host (ENetAddress * address, const char * name) char buffer [2048]; int errnum; -#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); #else hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum); @@ -165,7 +165,7 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng in.s_addr = address -> host; -#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); #else hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & errnum); @@ -249,7 +249,7 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) { case ENET_SOCKOPT_NONBLOCK: #ifdef HAS_FCNTL - result = fcntl (socket, F_SETFL, O_NONBLOCK | fcntl (socket, F_GETFL)); + result = fcntl (socket, F_SETFL, (value ? O_NONBLOCK : 0) | (fcntl (socket, F_GETFL) & ~O_NONBLOCK)); #else result = ioctl (socket, FIONBIO, & value); #endif diff --git a/polymer/eduke32/source/enet/src/win32.c b/polymer/eduke32/source/enet/src/win32.c index 04c724665..5cc167997 100644 --- a/polymer/eduke32/source/enet/src/win32.c +++ b/polymer/eduke32/source/enet/src/win32.c @@ -4,9 +4,10 @@ */ #ifdef _WIN32 -#include #define ENET_BUILDING_LIB 1 #include "enet/enet.h" +#include +#include static enet_uint32 timeBase = 0;