From 29cbf82230087db1bd16884617754dbee23e4534 Mon Sep 17 00:00:00 2001 From: eihrul Date: Thu, 13 May 2010 16:55:59 +0000 Subject: use dispatch queues to cut down on array crawling costs --- include/enet/enet.h | 7 +++++-- include/enet/list.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/enet/enet.h b/include/enet/enet.h index f6fd240..b139976 100644 --- a/include/enet/enet.h +++ b/include/enet/enet.h @@ -226,6 +226,7 @@ typedef struct _ENetChannel */ typedef struct _ENetPeer { + ENetListNode dispatchList; struct _ENetHost * host; enet_uint16 outgoingPeerID; enet_uint16 incomingPeerID; @@ -272,6 +273,8 @@ typedef struct _ENetPeer ENetList sentUnreliableCommands; ENetList outgoingReliableCommands; ENetList outgoingUnreliableCommands; + ENetList dispatchedCommands; + int needsDispatch; enet_uint16 incomingUnsequencedGroup; enet_uint16 outgoingUnsequencedGroup; enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; @@ -303,7 +306,7 @@ typedef struct _ENetHost ENetPeer * peers; /**< array of peers allocated for this host */ size_t peerCount; /**< number of peers allocated for this host */ enet_uint32 serviceTime; - ENetPeer * lastServicedPeer; + ENetList dispatchQueue; int continueSending; size_t packetSize; enet_uint16 headerFlags; @@ -469,7 +472,7 @@ ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uin extern void enet_host_bandwidth_throttle (ENetHost *); ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *); -ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8); +ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8 * channelID); ENET_API void enet_peer_ping (ENetPeer *); ENET_API void enet_peer_reset (ENetPeer *); ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32); diff --git a/include/enet/list.h b/include/enet/list.h index 99bc4ae..d7b2600 100644 --- a/include/enet/list.h +++ b/include/enet/list.h @@ -24,6 +24,7 @@ extern void enet_list_clear (ENetList *); extern ENetListIterator enet_list_insert (ENetListIterator, void *); extern void * enet_list_remove (ENetListIterator); +extern ENetListIterator enet_list_move (ENetListIterator, void *, void *); extern size_t enet_list_size (ENetList *); -- cgit v1.2.3