After reading through that post I linked above again, I notice that the error that seems to be generated when this problem occurs seems to be coded here:
EQStream.cpp
Code:
if(CompareSequence(NextOutSeq, seq_send) == SeqFuture) {
_log(NET__ERROR, _L "Tried to write a packet beyond the end of the queue! (%d is past next out %d)" __L, seq_send, NextOutSeq);
sitr=SequencedQueue.end();
continue;
}
And, looking into what that piece of code does, I looked at CompareSequence and SeqFuture so far. Here is the code for that command and I noted a part in RED that I think might be a mistake:
Code:
//returns SeqFuture if `seq` is later than `expected_seq`
EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq)
{
if (expected_seq==seq) {
// Curent
return SeqInOrder;
} else if ((seq > expected_seq && (uint32)seq < ((uint32)expected_seq + EQStream::MaxWindowSize)) || seq < (expected_seq - EQStream::MaxWindowSize)) {
// Future
return SeqFuture;
} else {
// Past
return SeqPast;
}
}
I think that line might need to be removed and replaced with this:
Code:
} else if (seq > expected_seq && (uint32)seq < ((uint32)expected_seq + EQStream::MaxWindowSize)) {
That should label all packets that are lower than the expected sequence as SeqPast. It will also label any any packets that are above the MaxWindowSize as SeqPast. And, if an ack is set as SeqPast, it should always SendOutOfOrderAck, which means it should correct most out of order issues I think.
Here is the MaxWindowSize setting code:
Code:
uint16 EQStream::MaxWindowSize=2048;
I will try to get the minor change noted above in and tested on my server and see if anything funky starts happening or if it has any noticeable effect. But, since I only run a Linux server, I won't see player ghosts anyway, so it might be pointless for me to test it. But, as long as it doesn't break anything, I could always update it in the new SVN and when Cavedude builds the Win32 binaries, windows servers could easily start testing and see what happens if anything.
Just from reading through the EQStream.cpp file, to me it looks like they are doing some sloppy stuff and maybe some extra work that isn't really needed. But, I am definitely no expert or anywhere near as skilled as the people who originally wrote that file. It seems like we could just check if an ack is in order and if not then always send an OutOfOrder ack. Maybe if we play with this file for a while, we can get most or all network issues worked out.