Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8088


Ignore:
Timestamp:
Mar 18, 2011, 12:08:44 AM (14 years ago)
Author:
adrfried
Message:

Updated Enet to version 1.3.1

updated patch

Location:
code/trunk/src/external/enet
Files:
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • code/trunk/src/external/enet/ChangeLog

    r7459 r8088  
     1ENet 1.3.1 (February 10, 2011):
     2
     3* fixed bug in tracking of reliable data in transit
     4* reliable data window size now scales with the throttle
     5* fixed bug in fragment length calculation when checksums are used
     6
    17ENet 1.3.0 (June 5, 2010):
    28
  • code/trunk/src/external/enet/LICENSE

    r7459 r8088  
    1 Copyright (c) 2002-2010 Lee Salzman
     1Copyright (c) 2002-2011 Lee Salzman
    22
    33Permission 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:
  • code/trunk/src/external/enet/VERSION

    r7529 r8088  
    1 ENet 1.3.0 fetched from CVS with last revision from
    2 Thu Jul 29 02:42:28 2010 +0000
    3 This is one small change beyond the 1.3.0 tarball.
     1ENet 1.3.1 fetched from CVS with last revision from
     2Thu Feb 10 02:54:08 2011 +0000
  • code/trunk/src/external/enet/enet.h

    r7459 r8088  
    2626#define ENET_VERSION_MAJOR 1
    2727#define ENET_VERSION_MINOR 3
    28 #define ENET_VERSION_PATCH 0
     28#define ENET_VERSION_PATCH 1
    2929#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
    3030#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)
  • code/trunk/src/external/enet/patches/0001-Add-IPv6-support-to-Enet.patch

    r8079 r8088  
    1 From 68e3ac1c2876aedb62a77fdc7ba71e4983a6b99d Mon Sep 17 00:00:00 2001
     1From 7a7274dad3f90d206e91c0712ea0d2599850b24e Mon Sep 17 00:00:00 2001
    22From: Adrian Friedli <adi@koalatux.ch>
    33Date: Thu, 2 Sep 2010 14:26:42 +0200
    4 Subject: [PATCH] IPv6 support
     4Subject: [PATCH] Add IPv6 support to Enet
    55
    66---
    77 host.c               |   57 +++++++---
    88 include/enet/enet.h  |   64 ++++++++---
    9  include/enet/win32.h |    5 +
     9 include/enet/win32.h |    4 +
    1010 protocol.c           |   73 ++++++++++--
    1111 unix.c               |  312 ++++++++++++++++++++++++++++++--------------------
    12  win32.c              |  245 ++++++++++++++++++++++++++--------------
    13  6 files changed, 506 insertions(+), 250 deletions(-)
     12 win32.c              |  247 ++++++++++++++++++++++++++--------------
     13 6 files changed, 507 insertions(+), 250 deletions(-)
     14 mode change 100755 => 100644 Doxyfile
     15 mode change 100755 => 100644 docs/FAQ.dox
     16 mode change 100755 => 100644 docs/design.dox
     17 mode change 100755 => 100644 docs/install.dox
     18 mode change 100755 => 100644 docs/license.dox
     19 mode change 100755 => 100644 docs/mainpage.dox
     20 mode change 100755 => 100644 docs/tutorial.dox
     21 mode change 100755 => 100644 enet.dsp
    1422
     23diff --git a/Doxyfile b/Doxyfile
     24old mode 100755
     25new mode 100644
     26diff --git a/docs/FAQ.dox b/docs/FAQ.dox
     27old mode 100755
     28new mode 100644
     29diff --git a/docs/design.dox b/docs/design.dox
     30old mode 100755
     31new mode 100644
     32diff --git a/docs/install.dox b/docs/install.dox
     33old mode 100755
     34new mode 100644
     35diff --git a/docs/license.dox b/docs/license.dox
     36old mode 100755
     37new mode 100644
     38diff --git a/docs/mainpage.dox b/docs/mainpage.dox
     39old mode 100755
     40new mode 100644
     41diff --git a/docs/tutorial.dox b/docs/tutorial.dox
     42old mode 100755
     43new mode 100644
     44diff --git a/enet.dsp b/enet.dsp
     45old mode 100755
     46new mode 100644
    1547diff --git a/host.c b/host.c
    1648index 8bb2433..a9d157b 100644
     
    107139          currentPeer < & host -> peers [host -> peerCount];
    108140diff --git a/include/enet/enet.h b/include/enet/enet.h
    109 index 2f656d6..7b468a0 100644
     141index b572590..8351166 100644
    110142--- a/include/enet/enet.h
    111143+++ b/include/enet/enet.h
     
    216248 ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32);
    217249diff --git a/include/enet/win32.h b/include/enet/win32.h
    218 index 0e1cf0c..53a7ff7 100644
     250index 0e1cf0c..6145851 100644
    219251--- a/include/enet/win32.h
    220252+++ b/include/enet/win32.h
    221 @@ -14,6 +14,7 @@
    222  
    223  #include <stdlib.h>
    224  #include <winsock2.h>
    225 +#include <ws2tcpip.h>
    226  
    227  typedef SOCKET ENetSocket;
    228  
    229 @@ -53,6 +54,10 @@ typedef fd_set ENetSocketSet;
     253@@ -53,6 +53,10 @@ typedef fd_set ENetSocketSet;
    230254 #define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset))
    231255 #define ENET_SOCKETSET_CHECK(sockset, socket)  FD_ISSET (socket, & (sockset))
     
    239263 
    240264diff --git a/protocol.c b/protocol.c
    241 index 8e26dfb..cfef646 100644
     265index 2237ba8..7205d1b 100644
    242266--- a/protocol.c
    243267+++ b/protocol.c
     
    265289 enet_protocol_command_size (enet_uint8 commandNumber)
    266290 {
    267 @@ -262,9 +278,9 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
     291@@ -266,9 +282,9 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
    268292          ++ currentPeer)
    269293     {
     
    277301     }
    278302 
    279 @@ -848,10 +864,11 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
     303@@ -852,10 +868,11 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
    280304 
    281305        if (peer -> state == ENET_PEER_STATE_DISCONNECTED ||
     
    292316     }
    293317 
    294 @@ -891,8 +908,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
     318@@ -895,8 +912,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event)
    295319       
    296320     if (peer != NULL)
     
    302326     }
    303327     
    304 @@ -1021,7 +1037,7 @@ commandError:
     328@@ -1025,7 +1041,7 @@ commandError:
    305329 }
    306330 
     
    311335     for (;;)
    312336     {
    313 @@ -1031,10 +1047,11 @@ enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
     337@@ -1035,10 +1051,11 @@ enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
    314338        buffer.data = host -> packetData [0];
    315339        buffer.dataLength = sizeof (host -> packetData [0]);
     
    325349        if (receivedLength < 0)
    326350          return -1;
    327 @@ -1042,6 +1059,9 @@ enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
     351@@ -1046,6 +1063,9 @@ enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
    328352        if (receivedLength == 0)
    329353          return 0;
     
    335359        host -> receivedDataLength = receivedLength;
    336360       
    337 @@ -1373,6 +1393,9 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch
     361@@ -1397,6 +1417,9 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch
    338362          currentPeer < & host -> peers [host -> peerCount];
    339363          ++ currentPeer)
     
    345369             currentPeer -> state == ENET_PEER_STATE_ZOMBIE)
    346370           continue;
    347 @@ -1497,7 +1520,15 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch
     371@@ -1520,7 +1543,15 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch
    348372 
    349373         currentPeer -> lastSendTime = host -> serviceTime;
     
    362386         enet_protocol_remove_sent_unreliable_commands (currentPeer);
    363387 
    364 @@ -1608,7 +1639,23 @@ enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout)
     388@@ -1631,7 +1662,23 @@ enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout)
    365389           break;
    366390        }
     
    387411        case 1:
    388412           return 1;
    389 @@ -1660,7 +1707,7 @@ enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout)
     413@@ -1683,7 +1730,7 @@ enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout)
    390414 
    391415        waitCondition = ENET_SOCKET_WAIT_RECEIVE;
     
    874898 #endif
    875899diff --git a/win32.c b/win32.c
    876 index e1fae23..2607160 100644
     900index e1fae23..15b9888 100644
    877901--- a/win32.c
    878902+++ b/win32.c
    879 @@ -4,6 +4,8 @@
     903@@ -4,23 +4,27 @@
    880904 */
    881905 #ifdef WIN32
     
    884908+
    885909 #include <time.h>
     910+#include <ws2tcpip.h>
    886911 #define ENET_BUILDING_LIB 1
    887912 #include "enet/enet.h"
    888 @@ -13,14 +15,14 @@ static enet_uint32 timeBase = 0;
     913+#include <ws2tcpip.h>
     914 
     915 static enet_uint32 timeBase = 0;
     916 
    889917 int
    890918 enet_initialize (void)
     
    904932        WSACleanup ();
    905933       
    906 @@ -52,77 +54,139 @@ enet_time_set (enet_uint32 newTimeBase)
     934@@ -52,77 +56,139 @@ enet_time_set (enet_uint32 newTimeBase)
    907935     timeBase = (enet_uint32) timeGetTime () - newTimeBase;
    908936 }
     
    10841112 
    10851113 int
    1086 @@ -132,9 +196,10 @@ enet_socket_listen (ENetSocket socket, int backlog)
     1114@@ -132,9 +198,10 @@ enet_socket_listen (ENetSocket socket, int backlog)
    10871115 }
    10881116 
     
    10971125 
    10981126 int
    1099 @@ -173,28 +238,23 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
     1127@@ -173,28 +240,23 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
    11001128 }
    11011129 
     
    11341162 
    11351163     if (result == INVALID_SOCKET)
    1136 @@ -202,8 +262,7 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address)
     1164@@ -202,8 +264,7 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address)
    11371165 
    11381166     if (address != NULL)
     
    11441172 
    11451173     return result;
    1146 @@ -219,18 +278,15 @@ int
     1174@@ -219,18 +280,15 @@ int
    11471175 enet_socket_send (ENetSocket socket,
    11481176                   const ENetAddress * address,
     
    11671195 
    11681196     if (WSASendTo (socket,
    1169 @@ -239,7 +295,7 @@ enet_socket_send (ENetSocket socket,
     1197@@ -239,7 +297,7 @@ enet_socket_send (ENetSocket socket,
    11701198                    & sentLength,
    11711199                    0,
     
    11761204                    NULL) == SOCKET_ERROR)
    11771205     {
    1178 @@ -256,12 +312,13 @@ int
     1206@@ -256,12 +314,13 @@ int
    11791207 enet_socket_receive (ENetSocket socket,
    11801208                      ENetAddress * address,
     
    11931221     if (WSARecvFrom (socket,
    11941222                      (LPWSABUF) buffers,
    1195 @@ -288,8 +345,7 @@ enet_socket_receive (ENetSocket socket,
     1223@@ -288,8 +347,7 @@ enet_socket_receive (ENetSocket socket,
    11961224 
    11971225     if (address != NULL)
     
    12031231 
    12041232     return (int) recvLength;
    1205 @@ -307,25 +363,42 @@ enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocket
     1233@@ -307,25 +365,42 @@ enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocket
    12061234 }
    12071235 
     
    12521280     if (selectCount < 0)
    12531281       return -1;
    1254 @@ -335,14 +408,16 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
     1282@@ -335,14 +410,16 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou
    12551283     if (selectCount == 0)
    12561284       return 0;
     
    12761304 
    12771305--
    1278 1.7.1
     13061.7.4.1
    12791307
  • code/trunk/src/external/enet/peer.c

    r7459 r8088  
    109109
    110110   fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment);
     111   if (peer -> host -> checksum != NULL)
     112     fragmentLength -= sizeof(enet_uint32);
    111113
    112114   if (packet -> dataLength > fragmentLength)
  • code/trunk/src/external/enet/protocol.c

    r7459 r8088  
    189189    ENetListIterator currentCommand;
    190190    ENetProtocolCommand commandNumber;
     191    int wasSent = 1;
    191192
    192193    for (currentCommand = enet_list_begin (& peer -> sentReliableCommands);
     
    218219       if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands))
    219220         return ENET_PROTOCOL_COMMAND_NONE;
     221
     222       wasSent = 0;
    220223    }
    221224
     
    238241    if (outgoingCommand -> packet != NULL)
    239242    {
    240        peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
     243       if (wasSent)
     244         peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
    241245
    242246       -- outgoingCommand -> packet -> referenceCount;
     
    12731277}
    12741278
    1275 static void
     1279static int
    12761280enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
    12771281{
     
    12831287    enet_uint16 reliableWindow;
    12841288    size_t commandSize;
     1289    int windowExceeded = 0, windowWrap = 0, canPing = 1;
    12851290
    12861291    currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
     
    12921297       channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL;
    12931298       reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
    1294        if (channel != NULL &&
    1295            outgoingCommand -> sendAttempts < 1 &&
    1296            ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) &&
    1297            (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE ||
    1298              channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
    1299                (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow)))))
    1300          break;
    1301  
     1299       if (channel != NULL)
     1300       {
     1301           if (! windowWrap &&     
     1302               outgoingCommand -> sendAttempts < 1 &&
     1303               ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) &&
     1304               (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE ||
     1305                 channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
     1306                   (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow)))))
     1307             windowWrap = 1;
     1308          if (windowWrap)
     1309          {
     1310             currentCommand = enet_list_next (currentCommand);
     1311 
     1312             continue;
     1313          }
     1314       }
     1315 
     1316       if (outgoingCommand -> packet != NULL)
     1317       {
     1318          if (! windowExceeded)
     1319          {
     1320             enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
     1321             
     1322             if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
     1323               windowExceeded = 1;
     1324          }
     1325          if (windowExceeded)
     1326          {
     1327             currentCommand = enet_list_next (currentCommand);
     1328
     1329             continue;
     1330          }
     1331       }
     1332
     1333       canPing = 0;
     1334
    13021335       commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
    13031336       if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
    13041337           buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
    1305            peer -> mtu - host -> packetSize < commandSize)
     1338           peer -> mtu - host -> packetSize < commandSize ||
     1339           (outgoingCommand -> packet != NULL &&
     1340             (enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength)))
    13061341       {
    13071342          host -> continueSending = 1;
     
    13101345       }
    13111346
    1312        if (outgoingCommand -> packet != NULL)
    1313        {
    1314           if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > peer -> windowSize)
    1315             break;
    1316 
    1317           if ((enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength))
    1318           {
    1319              host -> continueSending = 1;
    1320 
    1321              break;
    1322           }
    1323        }
    1324      
    13251347       currentCommand = enet_list_next (currentCommand);
    13261348
     
    13751397    host -> commandCount = command - host -> commands;
    13761398    host -> bufferCount = buffer - host -> buffers;
     1399
     1400    return canPing;
    13771401}
    13781402
     
    14151439          return 1;
    14161440
    1417         if (! enet_list_empty (& currentPeer -> outgoingReliableCommands))
    1418           enet_protocol_send_reliable_outgoing_commands (host, currentPeer);
    1419         else
    1420         if (enet_list_empty (& currentPeer -> sentReliableCommands) &&
     1441        if ((enet_list_empty (& currentPeer -> outgoingReliableCommands) ||
     1442              enet_protocol_send_reliable_outgoing_commands (host, currentPeer)) &&
     1443            enet_list_empty (& currentPeer -> sentReliableCommands) &&
    14211444            ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL &&
    14221445            currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing))
Note: See TracChangeset for help on using the changeset viewer.