Changeset 8088 for code/trunk
- Timestamp:
- Mar 18, 2011, 12:08:44 AM (14 years ago)
- Location:
- code/trunk/src/external/enet
- Files:
-
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/enet/ChangeLog
r7459 r8088 1 ENet 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 1 7 ENet 1.3.0 (June 5, 2010): 2 8 -
code/trunk/src/external/enet/LICENSE
r7459 r8088 1 Copyright (c) 2002-201 0Lee Salzman1 Copyright (c) 2002-2011 Lee Salzman 2 2 3 3 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: -
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. 1 ENet 1.3.1 fetched from CVS with last revision from 2 Thu Feb 10 02:54:08 2011 +0000 -
code/trunk/src/external/enet/enet.h
r7459 r8088 26 26 #define ENET_VERSION_MAJOR 1 27 27 #define ENET_VERSION_MINOR 3 28 #define ENET_VERSION_PATCH 028 #define ENET_VERSION_PATCH 1 29 29 #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch)) 30 30 #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 68e3ac1c2876aedb62a77fdc7ba71e4983a6b99dMon Sep 17 00:00:00 20011 From 7a7274dad3f90d206e91c0712ea0d2599850b24e Mon Sep 17 00:00:00 2001 2 2 From: Adrian Friedli <adi@koalatux.ch> 3 3 Date: Thu, 2 Sep 2010 14:26:42 +0200 4 Subject: [PATCH] IPv6 support4 Subject: [PATCH] Add IPv6 support to Enet 5 5 6 6 --- 7 7 host.c | 57 +++++++--- 8 8 include/enet/enet.h | 64 ++++++++--- 9 include/enet/win32.h | 5+9 include/enet/win32.h | 4 + 10 10 protocol.c | 73 ++++++++++-- 11 11 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 14 22 23 diff --git a/Doxyfile b/Doxyfile 24 old mode 100755 25 new mode 100644 26 diff --git a/docs/FAQ.dox b/docs/FAQ.dox 27 old mode 100755 28 new mode 100644 29 diff --git a/docs/design.dox b/docs/design.dox 30 old mode 100755 31 new mode 100644 32 diff --git a/docs/install.dox b/docs/install.dox 33 old mode 100755 34 new mode 100644 35 diff --git a/docs/license.dox b/docs/license.dox 36 old mode 100755 37 new mode 100644 38 diff --git a/docs/mainpage.dox b/docs/mainpage.dox 39 old mode 100755 40 new mode 100644 41 diff --git a/docs/tutorial.dox b/docs/tutorial.dox 42 old mode 100755 43 new mode 100644 44 diff --git a/enet.dsp b/enet.dsp 45 old mode 100755 46 new mode 100644 15 47 diff --git a/host.c b/host.c 16 48 index 8bb2433..a9d157b 100644 … … 107 139 currentPeer < & host -> peers [host -> peerCount]; 108 140 diff --git a/include/enet/enet.h b/include/enet/enet.h 109 index 2f656d6..7b468a0100644141 index b572590..8351166 100644 110 142 --- a/include/enet/enet.h 111 143 +++ b/include/enet/enet.h … … 216 248 ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32); 217 249 diff --git a/include/enet/win32.h b/include/enet/win32.h 218 index 0e1cf0c.. 53a7ff7100644250 index 0e1cf0c..6145851 100644 219 251 --- a/include/enet/win32.h 220 252 +++ 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; 230 254 #define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset)) 231 255 #define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) … … 239 263 240 264 diff --git a/protocol.c b/protocol.c 241 index 8e26dfb..cfef646100644265 index 2237ba8..7205d1b 100644 242 266 --- a/protocol.c 243 267 +++ b/protocol.c … … 265 289 enet_protocol_command_size (enet_uint8 commandNumber) 266 290 { 267 @@ -26 2,9 +278,9 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet291 @@ -266,9 +282,9 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet 268 292 ++ currentPeer) 269 293 { … … 277 301 } 278 302 279 @@ -8 48,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) 280 304 281 305 if (peer -> state == ENET_PEER_STATE_DISCONNECTED || … … 292 316 } 293 317 294 @@ -89 1,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) 295 319 296 320 if (peer != NULL) … … 302 326 } 303 327 304 @@ -102 1,7 +1037,7 @@ commandError:328 @@ -1025,7 +1041,7 @@ commandError: 305 329 } 306 330 … … 311 335 for (;;) 312 336 { 313 @@ -103 1,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) 314 338 buffer.data = host -> packetData [0]; 315 339 buffer.dataLength = sizeof (host -> packetData [0]); … … 325 349 if (receivedLength < 0) 326 350 return -1; 327 @@ -104 2,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) 328 352 if (receivedLength == 0) 329 353 return 0; … … 335 359 host -> receivedDataLength = receivedLength; 336 360 337 @@ -13 73,6 +1393,9 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch361 @@ -1397,6 +1417,9 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch 338 362 currentPeer < & host -> peers [host -> peerCount]; 339 363 ++ currentPeer) … … 345 369 currentPeer -> state == ENET_PEER_STATE_ZOMBIE) 346 370 continue; 347 @@ -1 497,7 +1520,15 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch371 @@ -1520,7 +1543,15 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch 348 372 349 373 currentPeer -> lastSendTime = host -> serviceTime; … … 362 386 enet_protocol_remove_sent_unreliable_commands (currentPeer); 363 387 364 @@ -16 08,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) 365 389 break; 366 390 } … … 387 411 case 1: 388 412 return 1; 389 @@ -16 60,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) 390 414 391 415 waitCondition = ENET_SOCKET_WAIT_RECEIVE; … … 874 898 #endif 875 899 diff --git a/win32.c b/win32.c 876 index e1fae23.. 2607160100644900 index e1fae23..15b9888 100644 877 901 --- a/win32.c 878 902 +++ b/win32.c 879 @@ -4, 6 +4,8@@903 @@ -4,23 +4,27 @@ 880 904 */ 881 905 #ifdef WIN32 … … 884 908 + 885 909 #include <time.h> 910 +#include <ws2tcpip.h> 886 911 #define ENET_BUILDING_LIB 1 887 912 #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 889 917 int 890 918 enet_initialize (void) … … 904 932 WSACleanup (); 905 933 906 @@ -52,77 +5 4,139 @@ enet_time_set (enet_uint32 newTimeBase)934 @@ -52,77 +56,139 @@ enet_time_set (enet_uint32 newTimeBase) 907 935 timeBase = (enet_uint32) timeGetTime () - newTimeBase; 908 936 } … … 1084 1112 1085 1113 int 1086 @@ -132,9 +19 6,10 @@ enet_socket_listen (ENetSocket socket, int backlog)1114 @@ -132,9 +198,10 @@ enet_socket_listen (ENetSocket socket, int backlog) 1087 1115 } 1088 1116 … … 1097 1125 1098 1126 int 1099 @@ -173,28 +2 38,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) 1100 1128 } 1101 1129 … … 1134 1162 1135 1163 if (result == INVALID_SOCKET) 1136 @@ -202,8 +26 2,7 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address)1164 @@ -202,8 +264,7 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address) 1137 1165 1138 1166 if (address != NULL) … … 1144 1172 1145 1173 return result; 1146 @@ -219,18 +2 78,15 @@ int1174 @@ -219,18 +280,15 @@ int 1147 1175 enet_socket_send (ENetSocket socket, 1148 1176 const ENetAddress * address, … … 1167 1195 1168 1196 if (WSASendTo (socket, 1169 @@ -239,7 +29 5,7 @@ enet_socket_send (ENetSocket socket,1197 @@ -239,7 +297,7 @@ enet_socket_send (ENetSocket socket, 1170 1198 & sentLength, 1171 1199 0, … … 1176 1204 NULL) == SOCKET_ERROR) 1177 1205 { 1178 @@ -256,12 +31 2,13 @@ int1206 @@ -256,12 +314,13 @@ int 1179 1207 enet_socket_receive (ENetSocket socket, 1180 1208 ENetAddress * address, … … 1193 1221 if (WSARecvFrom (socket, 1194 1222 (LPWSABUF) buffers, 1195 @@ -288,8 +34 5,7 @@ enet_socket_receive (ENetSocket socket,1223 @@ -288,8 +347,7 @@ enet_socket_receive (ENetSocket socket, 1196 1224 1197 1225 if (address != NULL) … … 1203 1231 1204 1232 return (int) recvLength; 1205 @@ -307,25 +36 3,42 @@ enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocket1233 @@ -307,25 +365,42 @@ enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocket 1206 1234 } 1207 1235 … … 1252 1280 if (selectCount < 0) 1253 1281 return -1; 1254 @@ -335,14 +4 08,16 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou1282 @@ -335,14 +410,16 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou 1255 1283 if (selectCount == 0) 1256 1284 return 0; … … 1276 1304 1277 1305 -- 1278 1.7. 11306 1.7.4.1 1279 1307 -
code/trunk/src/external/enet/peer.c
r7459 r8088 109 109 110 110 fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment); 111 if (peer -> host -> checksum != NULL) 112 fragmentLength -= sizeof(enet_uint32); 111 113 112 114 if (packet -> dataLength > fragmentLength) -
code/trunk/src/external/enet/protocol.c
r7459 r8088 189 189 ENetListIterator currentCommand; 190 190 ENetProtocolCommand commandNumber; 191 int wasSent = 1; 191 192 192 193 for (currentCommand = enet_list_begin (& peer -> sentReliableCommands); … … 218 219 if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands)) 219 220 return ENET_PROTOCOL_COMMAND_NONE; 221 222 wasSent = 0; 220 223 } 221 224 … … 238 241 if (outgoingCommand -> packet != NULL) 239 242 { 240 peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; 243 if (wasSent) 244 peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; 241 245 242 246 -- outgoingCommand -> packet -> referenceCount; … … 1273 1277 } 1274 1278 1275 static void1279 static int 1276 1280 enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) 1277 1281 { … … 1283 1287 enet_uint16 reliableWindow; 1284 1288 size_t commandSize; 1289 int windowExceeded = 0, windowWrap = 0, canPing = 1; 1285 1290 1286 1291 currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); … … 1292 1297 channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL; 1293 1298 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 1302 1335 commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK]; 1303 1336 if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || 1304 1337 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))) 1306 1341 { 1307 1342 host -> continueSending = 1; … … 1310 1345 } 1311 1346 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 1325 1347 currentCommand = enet_list_next (currentCommand); 1326 1348 … … 1375 1397 host -> commandCount = command - host -> commands; 1376 1398 host -> bufferCount = buffer - host -> buffers; 1399 1400 return canPing; 1377 1401 } 1378 1402 … … 1415 1439 return 1; 1416 1440 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) && 1421 1444 ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL && 1422 1445 currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing))
Note: See TracChangeset
for help on using the changeset viewer.