*** empty log message ***

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1345 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2007-10-12 05:49:51 +00:00
parent 11f6d5e5dd
commit 6f00ce0054
7 changed files with 83 additions and 42 deletions
-1
View File
@@ -5,7 +5,6 @@
#define ENET_BUILDING_LIB 1
#include "enet/enet.h"
static ENetCallbacks callbacks = { malloc, free, rand };
int
+10 -10
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for libenet 10-02-2007.
# Generated by GNU Autoconf 2.61 for libenet 10-11-2007.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -572,8 +572,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='libenet'
PACKAGE_TARNAME='libenet'
PACKAGE_VERSION='10-02-2007'
PACKAGE_STRING='libenet 10-02-2007'
PACKAGE_VERSION='10-11-2007'
PACKAGE_STRING='libenet 10-11-2007'
PACKAGE_BUGREPORT=''
ac_subst_vars='SHELL
@@ -1168,7 +1168,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libenet 10-02-2007 to adapt to many kinds of systems.
\`configure' configures libenet 10-11-2007 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1234,7 +1234,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libenet 10-02-2007:";;
short | recursive ) echo "Configuration of libenet 10-11-2007:";;
esac
cat <<\_ACEOF
@@ -1318,7 +1318,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libenet configure 10-02-2007
libenet configure 10-11-2007
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1332,7 +1332,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libenet $as_me 10-02-2007, which was
It was created by libenet $as_me 10-11-2007, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2002,7 +2002,7 @@ fi
# Define the identity of the package.
PACKAGE=libenet.a
VERSION=10-02-2007
VERSION=10-11-2007
cat >>confdefs.h <<_ACEOF
@@ -4929,7 +4929,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libenet $as_me 10-02-2007, which was
This file was extended by libenet $as_me 10-11-2007, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4976,7 +4976,7 @@ Report bugs to <[email protected]>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
libenet config.status 10-02-2007
libenet config.status 10-11-2007
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+2 -2
View File
@@ -1,5 +1,5 @@
AC_INIT(libenet, 10-02-2007)
AM_INIT_AUTOMAKE(libenet.a, 10-02-2007)
AC_INIT(libenet, 10-11-2007)
AM_INIT_AUTOMAKE(libenet.a, 10-11-2007)
AC_PROG_CC
AC_PROG_RANLIB
+3 -1
View File
@@ -165,10 +165,12 @@ enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelC
channel -> outgoingReliableSequenceNumber = 0;
channel -> outgoingUnreliableSequenceNumber = 0;
channel -> incomingReliableSequenceNumber = 0;
channel -> incomingUnreliableSequenceNumber = 0;
enet_list_clear (& channel -> incomingReliableCommands);
enet_list_clear (& channel -> incomingUnreliableCommands);
channel -> usedReliableWindows = 0;
memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows));
}
command.header.command = ENET_PROTOCOL_COMMAND_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
+7 -2
View File
@@ -143,6 +143,7 @@ typedef struct _ENetOutgoingCommand
enet_uint32 roundTripTimeoutLimit;
enet_uint32 fragmentOffset;
enet_uint16 fragmentLength;
enet_uint16 sendAttempts;
ENetProtocol command;
ENetPacket * packet;
} ENetOutgoingCommand;
@@ -198,15 +199,19 @@ enum
ENET_PEER_TIMEOUT_MINIMUM = 5000,
ENET_PEER_TIMEOUT_MAXIMUM = 30000,
ENET_PEER_PING_INTERVAL = 500,
ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 4 * 32
ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 4 * 32,
ENET_PEER_RELIABLE_WINDOWS = 16,
ENET_PEER_RELIABLE_WINDOW_SIZE = 0x1000,
ENET_PEER_FREE_RELIABLE_WINDOWS = 8
};
typedef struct _ENetChannel
{
enet_uint16 outgoingReliableSequenceNumber;
enet_uint16 outgoingUnreliableSequenceNumber;
enet_uint16 usedReliableWindows;
enet_uint16 reliableWindows [ENET_PEER_RELIABLE_WINDOWS];
enet_uint16 incomingReliableSequenceNumber;
enet_uint16 incomingUnreliableSequenceNumber;
ENetList incomingReliableCommands;
ENetList incomingUnreliableCommands;
} ENetChannel;
+22 -18
View File
@@ -145,6 +145,9 @@ enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet)
command.header.channelID = channelID;
if (! (packet -> flags & (ENET_PACKET_FLAG_RELIABLE | ENET_PACKET_FLAG_UNSEQUENCED)) && channel -> outgoingUnreliableSequenceNumber >= 0xFFFF)
packet -> flags |= ENET_PACKET_FLAG_RELIABLE;
if (packet -> flags & ENET_PACKET_FLAG_RELIABLE)
{
command.header.command = ENET_PROTOCOL_COMMAND_SEND_RELIABLE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE;
@@ -189,8 +192,6 @@ enet_peer_receive (ENetPeer * peer, enet_uint8 channelID)
{
if (incomingCommand -> reliableSequenceNumber != channel -> incomingReliableSequenceNumber)
incomingCommand = NULL;
else
channel -> incomingUnreliableSequenceNumber = incomingCommand -> unreliableSequenceNumber;
}
}
@@ -505,7 +506,8 @@ enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command,
if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE)
{
++ channel -> outgoingReliableSequenceNumber;
channel -> outgoingUnreliableSequenceNumber = 0;
outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber;
outgoingCommand -> unreliableSequenceNumber = 0;
}
@@ -525,6 +527,7 @@ enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command,
outgoingCommand -> unreliableSequenceNumber = channel -> outgoingUnreliableSequenceNumber;
}
outgoingCommand -> sendAttempts = 0;
outgoingCommand -> sentTime = 0;
outgoingCommand -> roundTripTimeout = 0;
outgoingCommand -> roundTripTimeoutLimit = 0;
@@ -550,6 +553,7 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command,
{
ENetChannel * channel = & peer -> channels [command -> header.channelID];
enet_uint32 unreliableSequenceNumber = 0, reliableSequenceNumber;
enet_uint16 reliableWindow, currentWindow;
ENetIncomingCommand * incomingCommand;
ENetListIterator currentCommand;
@@ -559,12 +563,16 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command,
if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED)
{
reliableSequenceNumber = command -> header.reliableSequenceNumber;
reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
if (channel -> incomingReliableSequenceNumber >= 0xF000 && reliableSequenceNumber < 0x1000)
reliableSequenceNumber += 0x10000;
if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber ||
(channel -> incomingReliableSequenceNumber < 0x1000 && (reliableSequenceNumber & 0xFFFF) >= 0xF000))
if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
{
reliableWindow += ENET_PEER_RELIABLE_WINDOWS;
reliableSequenceNumber += 0x10000;
}
if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS)
goto freePacket;
}
@@ -581,7 +589,7 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command,
{
incomingCommand = (ENetIncomingCommand *) currentCommand;
if (reliableSequenceNumber >= 0x10000 && incomingCommand -> reliableSequenceNumber < 0xF000)
if (reliableSequenceNumber >= 0x10000 && incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
reliableSequenceNumber -= 0x10000;
if (incomingCommand -> reliableSequenceNumber <= reliableSequenceNumber)
@@ -597,13 +605,6 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command,
case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE:
unreliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendUnreliable.unreliableSequenceNumber);
if (channel -> incomingUnreliableSequenceNumber >= 0xF000 && unreliableSequenceNumber < 0x1000)
unreliableSequenceNumber += 0x10000;
if (unreliableSequenceNumber <= channel -> incomingUnreliableSequenceNumber ||
(channel -> incomingUnreliableSequenceNumber < 0x1000 && (unreliableSequenceNumber & 0xFFFF) >= 0xF000))
goto freePacket;
for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingUnreliableCommands));
currentCommand != enet_list_end (& channel -> incomingUnreliableCommands);
currentCommand = enet_list_previous (currentCommand))
@@ -613,8 +614,11 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command,
if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE)
continue;
if (unreliableSequenceNumber >= 0x10000 && incomingCommand -> unreliableSequenceNumber < 0xF000)
unreliableSequenceNumber -= 0x10000;
if (reliableSequenceNumber >= 0x10000 && incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber)
reliableSequenceNumber -= 0x10000;
if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber)
break;
if (incomingCommand -> unreliableSequenceNumber <= unreliableSequenceNumber)
{
+39 -8
View File
@@ -163,6 +163,8 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
ENetOutgoingCommand * outgoingCommand;
ENetListIterator currentCommand;
ENetProtocolCommand commandNumber;
ENetChannel * channel;
enet_uint16 reliableWindow;
for (currentCommand = enet_list_begin (& peer -> sentReliableCommands);
currentCommand != enet_list_end (& peer -> sentReliableCommands);
@@ -178,8 +180,17 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
if (currentCommand == enet_list_end (& peer -> sentReliableCommands))
return ENET_PROTOCOL_COMMAND_NONE;
commandNumber = outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK;
reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
channel = & peer -> channels [channelID];
if (channel -> reliableWindows [reliableWindow] > 0)
{
-- channel -> reliableWindows [reliableWindow];
if (! channel -> reliableWindows [reliableWindow])
channel -> usedReliableWindows &= ~ (1 << reliableWindow);
}
commandNumber = outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK;
enet_list_remove (& outgoingCommand -> outgoingCommandList);
if (outgoingCommand -> packet != NULL)
@@ -280,10 +291,12 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
channel -> outgoingReliableSequenceNumber = 0;
channel -> outgoingUnreliableSequenceNumber = 0;
channel -> incomingReliableSequenceNumber = 0;
channel -> incomingUnreliableSequenceNumber = 0;
enet_list_clear (& channel -> incomingReliableCommands);
enet_list_clear (& channel -> incomingUnreliableCommands);
channel -> usedReliableWindows = 0;
memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows));
}
mtu = ENET_NET_TO_HOST_16 (command -> connect.mtu);
@@ -1146,16 +1159,26 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
ENetBuffer * buffer = & host -> buffers [host -> bufferCount];
ENetOutgoingCommand * outgoingCommand;
ENetListIterator currentCommand;
ENetChannel *channel;
enet_uint16 reliableWindow;
size_t commandSize;
currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
while (currentCommand != enet_list_end (& peer -> outgoingReliableCommands))
{
size_t commandSize;
outgoingCommand = (ENetOutgoingCommand *) currentCommand;
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 -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow))))
break;
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)
@@ -1165,8 +1188,6 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
break;
}
currentCommand = enet_list_next (currentCommand);
if (outgoingCommand -> packet != NULL)
{
if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > peer -> windowSize)
@@ -1179,7 +1200,17 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
break;
}
}
currentCommand = enet_list_next (currentCommand);
if (channel != NULL && outgoingCommand -> sendAttempts < 1)
{
channel -> usedReliableWindows |= 1 << reliableWindow;
++ channel -> reliableWindows [reliableWindow];
}
++ outgoingCommand -> sendAttempts;
if (outgoingCommand -> roundTripTimeout == 0)
{
outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * peer -> roundTripTimeVariance;