Improving the PacketQue / Removing RefreshQueue
Posted: Sat Aug 27, 2005 8:10 pm
The RefreshQueue was a good idea, and I feel it has serviced UOX3 well.
However it is now my opinion that this step was too little towards what needs to be done.
It is my belief that we need ALL packets to be a part of a single que. This que is populated by a call to a function that would look something like: QueuePacket( UI16 packetNum, void *extInfo, CSocket *sendTo );
My thoughts on how this would work are as follows.
From there at the end of our checkTimers loop, we would do this:
That CallPacket() function would then use a switch statement to call the actual packet handler, making use of the void * to pull the object we are sending (if there is any object associated with this packet), the UI16 packet to pull the packet and any subcommand, and the CSocket to know which socket (or NULL for all) to send to.
This is still a VERY rough idea, and one that I only began thinking about last evening when working on the packet issues with the latest client. I have not done any testing and really don't know that this will even work. Mostly I would like feedback and criticism of this method of packet queueing, or thoughts on other ways to accomplish the same goal.
Thanks.
However it is now my opinion that this step was too little towards what needs to be done.
It is my belief that we need ALL packets to be a part of a single que. This que is populated by a call to a function that would look something like: QueuePacket( UI16 packetNum, void *extInfo, CSocket *sendTo );
My thoughts on how this would work are as follows.
Code: Select all
std::map< void *object, CPacketQueue > packetQueue;
class CPacketQueue
{
std::map< UI16 packet, CSocket *sendTo > sendList;
};
Code: Select all
std::map< void *object, CPacketQueue >::const_iterator pQIter = packetQueue.begin();
std::map< void *object, CPacketQueue >::const_iterator pQEnd = packetQueue.end();
while( pQIter != pQEnd )
{
std::map< UI16 packet, CSocket *sendTo >::const_iterator sLIter = pQIter->second.sendList.begin();
std::map< UI16 packet, CSocket *sendTo >::const_iterator sLEnd = pQIter->second.sendList.end();
while( sLIter != sLEnd )
{
CallPacket( pQIter->first, sLIter->first, sLIter->second );
++sLIter;
}
sendList.clear();
++pQIter;
}
packetQueue.clear();
This is still a VERY rough idea, and one that I only began thinking about last evening when working on the packet issues with the latest client. I have not done any testing and really don't know that this will even work. Mostly I would like feedback and criticism of this method of packet queueing, or thoughts on other ways to accomplish the same goal.
Thanks.