Merge branch 'master' of https://github.com/lsalzman/enet into moonlight
# Conflicts: # unix.c # win32.c
This commit is contained in:
+42
-13
@@ -19,7 +19,12 @@ check_struct_has_member("struct msghdr" "msg_flags" "sys/types.h;sys/socket.h" H
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h" "sys/socket.h")
|
||||
check_type_size("socklen_t" HAS_SOCKLEN_T BUILTIN_TYPES_ONLY)
|
||||
unset(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-W3)
|
||||
else()
|
||||
add_definitions(-Wno-error)
|
||||
endif()
|
||||
|
||||
if(HAS_FCNTL)
|
||||
add_definitions(-DHAS_FCNTL=1)
|
||||
endif()
|
||||
@@ -53,17 +58,41 @@ endif()
|
||||
if(HAS_SOCKLEN_T)
|
||||
add_definitions(-DHAS_SOCKLEN_T=1)
|
||||
endif()
|
||||
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
|
||||
set(INCLUDE_FILES_PREFIX include/enet)
|
||||
set(INCLUDE_FILES
|
||||
${INCLUDE_FILES_PREFIX}/callbacks.h
|
||||
${INCLUDE_FILES_PREFIX}/enet.h
|
||||
${INCLUDE_FILES_PREFIX}/list.h
|
||||
${INCLUDE_FILES_PREFIX}/protocol.h
|
||||
${INCLUDE_FILES_PREFIX}/time.h
|
||||
${INCLUDE_FILES_PREFIX}/types.h
|
||||
${INCLUDE_FILES_PREFIX}/unix.h
|
||||
${INCLUDE_FILES_PREFIX}/utility.h
|
||||
${INCLUDE_FILES_PREFIX}/win32.h
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
callbacks.c
|
||||
compress.c
|
||||
host.c
|
||||
list.c
|
||||
packet.c
|
||||
peer.c
|
||||
protocol.c
|
||||
unix.c
|
||||
win32.c)
|
||||
|
||||
source_group(include FILES ${INCLUDE_FILES})
|
||||
source_group(source FILES ${SOURCE_FILES})
|
||||
|
||||
add_library(enet STATIC
|
||||
callbacks.c
|
||||
compress.c
|
||||
host.c
|
||||
list.c
|
||||
packet.c
|
||||
peer.c
|
||||
protocol.c
|
||||
unix.c
|
||||
win32.c
|
||||
)
|
||||
${INCLUDE_FILES}
|
||||
${SOURCE_FILES}
|
||||
)
|
||||
|
||||
if (MINGW)
|
||||
target_link_libraries(enet winmm ws2_32)
|
||||
endif()
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
ENet 1.3.15 (April 20, 2020):
|
||||
|
||||
* quicker RTT initialization
|
||||
* use fractional precision for RTT calculations
|
||||
* fixes for packet throttle with low RTT variance
|
||||
* miscellaneous socket bug fixes
|
||||
|
||||
ENet 1.3.14 (January 27, 2019):
|
||||
|
||||
* bug fix for enet_peer_disconnect_later()
|
||||
* use getaddrinfo and getnameinfo where available
|
||||
* miscellenous cleanups
|
||||
|
||||
ENet 1.3.13 (April 30, 2015):
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ PROJECT_NAME = "ENet"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = v1.3.13
|
||||
PROJECT_NUMBER = v1.3.15
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2002-2016 Lee Salzman
|
||||
Copyright (c) 2002-2020 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:
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ enetinclude_HEADERS = \
|
||||
lib_LTLIBRARIES = libenet.la
|
||||
libenet_la_SOURCES = callbacks.c compress.c host.c list.c packet.c peer.c protocol.c unix.c win32.c
|
||||
# see info '(libtool) Updating version info' before making a release
|
||||
libenet_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:1:0
|
||||
libenet_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:3:0
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
ACLOCAL_AMFLAGS = -Im4
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
AC_INIT([libenet], [1.3.13])
|
||||
AC_INIT([libenet], [1.3.15])
|
||||
AC_CONFIG_SRCDIR([include/enet/enet.h])
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
@page License License
|
||||
|
||||
Copyright (c) 2002-2016 Lee Salzman
|
||||
Copyright (c) 2002-2020 Lee Salzman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ portable, and easily embeddable.
|
||||
You can retrieve the source to ENet by downloading it in either .tar.gz form
|
||||
or accessing the github distribution directly.
|
||||
|
||||
The most recent stable release (1.3.13) can be downloaded <a class="el" href="download/enet-1.3.13.tar.gz">here</a>.
|
||||
The most recent stable release (1.3.15) can be downloaded <a class="el" href="download/enet-1.3.15.tar.gz">here</a>.
|
||||
The last release that is protocol compatible with the 1.2 series or earlier (1.2.5) can be downloaded <a class="el" href="download/enet-1.2.5.tar.gz">here</a>.
|
||||
|
||||
You can find the most recent ENet source at <a class="el" href="https://github.com/lsalzman/enet">the github repository</a>.
|
||||
|
||||
+2
-2
@@ -102,8 +102,8 @@ may be simultaneously open.
|
||||
client = enet_host_create (NULL /* create a client host */,
|
||||
1 /* only allow 1 outgoing connection */,
|
||||
2 /* allow up 2 channels to be used, 0 and 1 */,
|
||||
57600 / 8 /* 56K modem with 56 Kbps downstream bandwidth */,
|
||||
14400 / 8 /* 56K modem with 14 Kbps upstream bandwidth */);
|
||||
0 /* assume any amount of incoming bandwidth */,
|
||||
0 /* assume any amount of outgoing bandwidth */);
|
||||
|
||||
if (client == NULL)
|
||||
{
|
||||
|
||||
+9
-2
@@ -25,7 +25,7 @@ extern "C"
|
||||
|
||||
#define ENET_VERSION_MAJOR 1
|
||||
#define ENET_VERSION_MINOR 3
|
||||
#define ENET_VERSION_PATCH 13
|
||||
#define ENET_VERSION_PATCH 15
|
||||
#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)
|
||||
@@ -239,6 +239,11 @@ typedef struct _ENetChannel
|
||||
ENetList incomingUnreliableCommands;
|
||||
} ENetChannel;
|
||||
|
||||
typedef enum _ENetPeerFlag
|
||||
{
|
||||
ENET_PEER_FLAG_NEEDS_DISPATCH = (1 << 0)
|
||||
} ENetPeerFlag;
|
||||
|
||||
/**
|
||||
* An ENet peer which data packets may be sent or received from.
|
||||
*
|
||||
@@ -300,7 +305,9 @@ typedef struct _ENetPeer
|
||||
ENetList outgoingReliableCommands;
|
||||
ENetList outgoingUnreliableCommands;
|
||||
ENetList dispatchedCommands;
|
||||
int needsDispatch;
|
||||
enet_uint16 flags;
|
||||
enet_uint8 roundTripTimeRemainder;
|
||||
enet_uint8 roundTripTimeVarianceRemainder;
|
||||
enet_uint16 incomingUnsequencedGroup;
|
||||
enet_uint16 outgoingUnsequencedGroup;
|
||||
enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32];
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#define ENET_MAX(x, y) ((x) > (y) ? (x) : (y))
|
||||
#define ENET_MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define ENET_DIFFERENCE(x, y) ((x) < (y) ? (y) - (x) : (x) - (y))
|
||||
|
||||
#endif /* __ENET_UTILITY_H__ */
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt)
|
||||
peer -> packetThrottle = peer -> packetThrottleLimit;
|
||||
}
|
||||
else
|
||||
if (rtt < peer -> lastRoundTripTime)
|
||||
if (rtt <= peer -> lastRoundTripTime)
|
||||
{
|
||||
peer -> packetThrottle += peer -> packetThrottleAcceleration;
|
||||
|
||||
@@ -76,7 +76,7 @@ enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt)
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
if (rtt > peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance)
|
||||
if (rtt >= peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance)
|
||||
{
|
||||
if (peer -> packetThrottle > peer -> packetThrottleDeceleration)
|
||||
peer -> packetThrottle -= peer -> packetThrottleDeceleration;
|
||||
@@ -306,11 +306,11 @@ enet_peer_reset_queues (ENetPeer * peer)
|
||||
{
|
||||
ENetChannel * channel;
|
||||
|
||||
if (peer -> needsDispatch)
|
||||
if (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH)
|
||||
{
|
||||
enet_list_remove (& peer -> dispatchList);
|
||||
|
||||
peer -> needsDispatch = 0;
|
||||
peer -> flags &= ~ ENET_PEER_FLAG_NEEDS_DISPATCH;
|
||||
}
|
||||
|
||||
while (! enet_list_empty (& peer -> acknowledgements))
|
||||
@@ -418,6 +418,9 @@ enet_peer_reset (ENetPeer * peer)
|
||||
peer -> outgoingUnsequencedGroup = 0;
|
||||
peer -> eventData = 0;
|
||||
peer -> totalWaitingData = 0;
|
||||
peer -> flags = 0;
|
||||
peer -> roundTripTimeRemainder = 0;
|
||||
peer -> roundTripTimeVarianceRemainder = 0;
|
||||
|
||||
memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow));
|
||||
|
||||
@@ -724,11 +727,11 @@ enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel *
|
||||
{
|
||||
enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand));
|
||||
|
||||
if (! peer -> needsDispatch)
|
||||
if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH))
|
||||
{
|
||||
enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList);
|
||||
|
||||
peer -> needsDispatch = 1;
|
||||
peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH;
|
||||
}
|
||||
|
||||
droppedCommand = currentCommand;
|
||||
@@ -752,11 +755,11 @@ enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel *
|
||||
{
|
||||
enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand));
|
||||
|
||||
if (! peer -> needsDispatch)
|
||||
if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH))
|
||||
{
|
||||
enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList);
|
||||
|
||||
peer -> needsDispatch = 1;
|
||||
peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -768,11 +771,11 @@ enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel *
|
||||
{
|
||||
enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand));
|
||||
|
||||
if (! peer -> needsDispatch)
|
||||
if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH))
|
||||
{
|
||||
enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList);
|
||||
|
||||
peer -> needsDispatch = 1;
|
||||
peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH;
|
||||
}
|
||||
|
||||
droppedCommand = currentCommand;
|
||||
@@ -809,11 +812,11 @@ enet_peer_dispatch_incoming_reliable_commands (ENetPeer * peer, ENetChannel * ch
|
||||
|
||||
enet_list_move (enet_list_end (& peer -> dispatchedCommands), enet_list_begin (& channel -> incomingReliableCommands), enet_list_previous (currentCommand));
|
||||
|
||||
if (! peer -> needsDispatch)
|
||||
if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH))
|
||||
{
|
||||
enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList);
|
||||
|
||||
peer -> needsDispatch = 1;
|
||||
peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH;
|
||||
}
|
||||
|
||||
if (! enet_list_empty (& channel -> incomingUnreliableCommands))
|
||||
|
||||
+41
-33
@@ -48,11 +48,11 @@ enet_protocol_dispatch_state (ENetHost * host, ENetPeer * peer, ENetPeerState st
|
||||
{
|
||||
enet_protocol_change_state (host, peer, state);
|
||||
|
||||
if (! peer -> needsDispatch)
|
||||
if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH))
|
||||
{
|
||||
enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList);
|
||||
|
||||
peer -> needsDispatch = 1;
|
||||
peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event)
|
||||
{
|
||||
ENetPeer * peer = (ENetPeer *) enet_list_remove (enet_list_begin (& host -> dispatchQueue));
|
||||
|
||||
peer -> needsDispatch = 0;
|
||||
peer -> flags &= ~ ENET_PEER_FLAG_NEEDS_DISPATCH;
|
||||
|
||||
switch (peer -> state)
|
||||
{
|
||||
@@ -101,7 +101,7 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event)
|
||||
|
||||
if (! enet_list_empty (& peer -> dispatchedCommands))
|
||||
{
|
||||
peer -> needsDispatch = 1;
|
||||
peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH;
|
||||
|
||||
enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList);
|
||||
}
|
||||
@@ -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
|
||||
@@ -841,24 +850,29 @@ enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer *
|
||||
if (ENET_TIME_LESS (host -> serviceTime, receivedSentTime))
|
||||
return 0;
|
||||
|
||||
peer -> lastReceiveTime = host -> serviceTime;
|
||||
peer -> earliestTimeout = 0;
|
||||
|
||||
roundTripTime = ENET_TIME_DIFFERENCE (host -> serviceTime, receivedSentTime);
|
||||
roundTripTime = ENET_MAX (roundTripTime, 1);
|
||||
|
||||
enet_peer_throttle (peer, roundTripTime);
|
||||
|
||||
peer -> roundTripTimeVariance -= peer -> roundTripTimeVariance / 4;
|
||||
|
||||
if (roundTripTime >= peer -> roundTripTime)
|
||||
if (peer -> lastReceiveTime > 0)
|
||||
{
|
||||
peer -> roundTripTime += (roundTripTime - peer -> roundTripTime) / 8;
|
||||
peer -> roundTripTimeVariance += (roundTripTime - peer -> roundTripTime) / 4;
|
||||
enet_uint32 accumRoundTripTime = (peer -> roundTripTime << 8) + peer -> roundTripTimeRemainder;
|
||||
enet_uint32 accumRoundTripTimeVariance = (peer -> roundTripTimeVariance << 8) + peer -> roundTripTimeVarianceRemainder;
|
||||
|
||||
enet_peer_throttle (peer, roundTripTime);
|
||||
|
||||
roundTripTime <<= 8;
|
||||
accumRoundTripTimeVariance = (accumRoundTripTimeVariance * 3 + ENET_DIFFERENCE (roundTripTime, accumRoundTripTime)) / 4;
|
||||
accumRoundTripTime = (accumRoundTripTime * 7 + roundTripTime) / 8;
|
||||
|
||||
peer -> roundTripTime = accumRoundTripTime >> 8;
|
||||
peer -> roundTripTimeRemainder = accumRoundTripTime & 0xFF;
|
||||
peer -> roundTripTimeVariance = accumRoundTripTimeVariance >> 8;
|
||||
peer -> roundTripTimeVarianceRemainder = accumRoundTripTimeVariance & 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
peer -> roundTripTime -= (peer -> roundTripTime - roundTripTime) / 8;
|
||||
peer -> roundTripTimeVariance += (peer -> roundTripTime - roundTripTime) / 4;
|
||||
peer -> roundTripTime = roundTripTime;
|
||||
peer -> roundTripTimeVariance = (roundTripTime + 1) / 2;
|
||||
}
|
||||
|
||||
if (peer -> roundTripTime < peer -> lowestRoundTripTime)
|
||||
@@ -871,12 +885,15 @@ enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer *
|
||||
ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> packetThrottleEpoch) >= peer -> packetThrottleInterval)
|
||||
{
|
||||
peer -> lastRoundTripTime = peer -> lowestRoundTripTime;
|
||||
peer -> lastRoundTripTimeVariance = peer -> highestRoundTripTimeVariance;
|
||||
peer -> lastRoundTripTimeVariance = ENET_MAX (peer -> highestRoundTripTimeVariance, 2);
|
||||
peer -> lowestRoundTripTime = peer -> roundTripTime;
|
||||
peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance;
|
||||
peer -> packetThrottleEpoch = host -> serviceTime;
|
||||
}
|
||||
|
||||
peer -> lastReceiveTime = ENET_MAX (host -> serviceTime, 1);
|
||||
peer -> earliestTimeout = 0;
|
||||
|
||||
receivedReliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedReliableSequenceNumber);
|
||||
|
||||
commandNumber = enet_protocol_remove_sent_reliable_command (peer, receivedReliableSequenceNumber, command -> header.channelID);
|
||||
@@ -1249,7 +1266,7 @@ enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1402,7 +1419,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);
|
||||
}
|
||||
|
||||
@@ -1650,19 +1668,9 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch
|
||||
#ifdef ENET_DEBUG
|
||||
printf ("peer %u: %f%%+-%f%% packet loss, %u+-%u ms round trip time, %f%% throttle, %u/%u outgoing, %u/%u incoming\n", currentPeer -> incomingPeerID, currentPeer -> packetLoss / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> packetLossVariance / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> roundTripTime, currentPeer -> roundTripTimeVariance, currentPeer -> packetThrottle / (float) ENET_PEER_PACKET_THROTTLE_SCALE, enet_list_size (& currentPeer -> outgoingReliableCommands), enet_list_size (& currentPeer -> outgoingUnreliableCommands), currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingReliableCommands) : 0, currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingUnreliableCommands) : 0);
|
||||
#endif
|
||||
|
||||
currentPeer -> packetLossVariance -= currentPeer -> packetLossVariance / 4;
|
||||
|
||||
if (packetLoss >= currentPeer -> packetLoss)
|
||||
{
|
||||
currentPeer -> packetLoss += (packetLoss - currentPeer -> packetLoss) / 8;
|
||||
currentPeer -> packetLossVariance += (packetLoss - currentPeer -> packetLoss) / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPeer -> packetLoss -= (currentPeer -> packetLoss - packetLoss) / 8;
|
||||
currentPeer -> packetLossVariance += (currentPeer -> packetLoss - packetLoss) / 4;
|
||||
}
|
||||
currentPeer -> packetLossVariance = (currentPeer -> packetLossVariance * 3 + ENET_DIFFERENCE (packetLoss, currentPeer -> packetLoss)) / 4;
|
||||
currentPeer -> packetLoss = (currentPeer -> packetLoss * 7 + packetLoss) / 8;
|
||||
|
||||
currentPeer -> packetLossEpoch = host -> serviceTime;
|
||||
currentPeer -> packetsSent = 0;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/time.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
@@ -87,7 +86,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAS_POLL
|
||||
#include <sys/poll.h>
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAS_SOCKLEN_T
|
||||
|
||||
Reference in New Issue
Block a user