Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 39a851cb16 | |||
| c77495463b | |||
| 0419c707e9 | |||
| 5258b40640 | |||
| 907b4ba2f5 | |||
| 7af1cd0de7 | |||
| 6ad4a745fb | |||
| 1e18fd6001 |
@@ -1,3 +1,9 @@
|
||||
ENet 1.3.1 (February 10, 2011):
|
||||
|
||||
* fixed bug in tracking of reliable data in transit
|
||||
* reliable data window size now scales with the throttle
|
||||
* fixed bug in fragment length calculation when checksums are used
|
||||
|
||||
ENet 1.3.0 (June 5, 2010):
|
||||
|
||||
* enet_host_create() now requires the channel limit to be specified as
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2002-2010 Lee Salzman
|
||||
Copyright (c) 2002-2011 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 1:0:0
|
||||
libenet_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:1:0
|
||||
INCLUDES = -Iinclude
|
||||
|
||||
ACLOCAL_AMFLAGS = -Im4
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
AC_INIT([libenet], [1.3.0])
|
||||
AC_INIT([libenet], [1.3.1])
|
||||
AC_CONFIG_SRCDIR([include/enet/enet.h])
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ portable, and easily embeddable.
|
||||
You can retrieve the source to ENet by downloading it in either .tar.gz form
|
||||
or accessing the cvs distribution directly.
|
||||
|
||||
The most recent stable release (1.3.0) can be downloaded <a href="http://enet.bespin.org/download/enet-1.3.0.tar.gz">here</a>.
|
||||
The last release that is protocol compatible with the 1.2 series or earlier (1.2.2) can be downloaded <a href="http://enet.bespin.org/download/enet-1.2.2.tar.gz">here</a>
|
||||
The most recent stable release (1.3.1) can be downloaded <a href="http://enet.bespin.org/download/enet-1.3.1.tar.gz">here</a>.
|
||||
The last release that is protocol compatible with the 1.2 series or earlier (1.2.3) can be downloaded <a href="http://enet.bespin.org/download/enet-1.2.3.tar.gz">here</a>
|
||||
|
||||
To access ENet via anonymous CVS, you must use the CVSROOT
|
||||
:pserver:anonymous\@bespin.org:/var/lib/cvs/enet with an empty
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ extern "C"
|
||||
|
||||
#define ENET_VERSION_MAJOR 1
|
||||
#define ENET_VERSION_MINOR 3
|
||||
#define ENET_VERSION_PATCH 0
|
||||
#define ENET_VERSION_PATCH 1
|
||||
#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
|
||||
#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)
|
||||
|
||||
|
||||
@@ -108,6 +108,8 @@ enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet)
|
||||
return -1;
|
||||
|
||||
fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment);
|
||||
if (peer -> host -> checksum != NULL)
|
||||
fragmentLength -= sizeof(enet_uint32);
|
||||
|
||||
if (packet -> dataLength > fragmentLength)
|
||||
{
|
||||
|
||||
+51
-28
@@ -172,6 +172,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
|
||||
ENetOutgoingCommand * outgoingCommand;
|
||||
ENetListIterator currentCommand;
|
||||
ENetProtocolCommand commandNumber;
|
||||
int wasSent = 1;
|
||||
|
||||
for (currentCommand = enet_list_begin (& peer -> sentReliableCommands);
|
||||
currentCommand != enet_list_end (& peer -> sentReliableCommands);
|
||||
@@ -201,6 +202,8 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
|
||||
|
||||
if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands))
|
||||
return ENET_PROTOCOL_COMMAND_NONE;
|
||||
|
||||
wasSent = 0;
|
||||
}
|
||||
|
||||
if (channelID < peer -> channelCount)
|
||||
@@ -221,7 +224,8 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
|
||||
|
||||
if (outgoingCommand -> packet != NULL)
|
||||
{
|
||||
peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
|
||||
if (wasSent)
|
||||
peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
|
||||
|
||||
-- outgoingCommand -> packet -> referenceCount;
|
||||
|
||||
@@ -1252,7 +1256,7 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
|
||||
{
|
||||
ENetProtocol * command = & host -> commands [host -> commandCount];
|
||||
@@ -1262,6 +1266,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
|
||||
ENetChannel *channel;
|
||||
enet_uint16 reliableWindow;
|
||||
size_t commandSize;
|
||||
int windowExceeded = 0, windowWrap = 0, canPing = 1;
|
||||
|
||||
currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
|
||||
|
||||
@@ -1271,37 +1276,54 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
|
||||
|
||||
channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL;
|
||||
reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
|
||||
if (channel != NULL &&
|
||||
outgoingCommand -> sendAttempts < 1 &&
|
||||
! (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)))))
|
||||
break;
|
||||
|
||||
if (channel != NULL)
|
||||
{
|
||||
if (! windowWrap &&
|
||||
outgoingCommand -> sendAttempts < 1 &&
|
||||
! (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)))))
|
||||
windowWrap = 1;
|
||||
if (windowWrap)
|
||||
{
|
||||
currentCommand = enet_list_next (currentCommand);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (outgoingCommand -> packet != NULL)
|
||||
{
|
||||
if (! windowExceeded)
|
||||
{
|
||||
enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
|
||||
|
||||
if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
|
||||
windowExceeded = 1;
|
||||
}
|
||||
if (windowExceeded)
|
||||
{
|
||||
currentCommand = enet_list_next (currentCommand);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
canPing = 0;
|
||||
|
||||
commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
|
||||
if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
|
||||
buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
|
||||
peer -> mtu - host -> packetSize < commandSize)
|
||||
peer -> mtu - host -> packetSize < commandSize ||
|
||||
(outgoingCommand -> packet != NULL &&
|
||||
(enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength)))
|
||||
{
|
||||
host -> continueSending = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (outgoingCommand -> packet != NULL)
|
||||
{
|
||||
if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > peer -> windowSize)
|
||||
break;
|
||||
|
||||
if ((enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength))
|
||||
{
|
||||
host -> continueSending = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
currentCommand = enet_list_next (currentCommand);
|
||||
|
||||
if (channel != NULL && outgoingCommand -> sendAttempts < 1)
|
||||
@@ -1354,6 +1376,8 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
|
||||
|
||||
host -> commandCount = command - host -> commands;
|
||||
host -> bufferCount = buffer - host -> buffers;
|
||||
|
||||
return canPing;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1391,10 +1415,9 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch
|
||||
enet_protocol_check_timeouts (host, currentPeer, event) == 1)
|
||||
return 1;
|
||||
|
||||
if (! enet_list_empty (& currentPeer -> outgoingReliableCommands))
|
||||
enet_protocol_send_reliable_outgoing_commands (host, currentPeer);
|
||||
else
|
||||
if (enet_list_empty (& currentPeer -> sentReliableCommands) &&
|
||||
if ((enet_list_empty (& currentPeer -> outgoingReliableCommands) ||
|
||||
enet_protocol_send_reliable_outgoing_commands (host, currentPeer)) &&
|
||||
enet_list_empty (& currentPeer -> sentReliableCommands) &&
|
||||
ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL &&
|
||||
currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user