mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-06 16:22:25 +00:00
Style changes (auto, post-inc to pre-inc)
This commit is contained in:
parent
1551e5d908
commit
761c2be722
@ -425,14 +425,11 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
|
|||||||
uint16 index = seq - SequencedBase;
|
uint16 index = seq - SequencedBase;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize);
|
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize);
|
||||||
if (index < sqsize) {
|
if (index < sqsize) {
|
||||||
std::deque<EQProtocolPacket *>::iterator sitr;
|
SequencedQueue[index]->acked = true;
|
||||||
sitr = SequencedQueue.begin();
|
|
||||||
sitr += index;
|
|
||||||
(*sitr)->acked = true;
|
|
||||||
// flag packets for a resend
|
// flag packets for a resend
|
||||||
uint16 count = 0;
|
uint16 count = 0;
|
||||||
uint32 timeout = AverageDelta * 2 + 100;
|
uint32 timeout = AverageDelta * 2 + 100;
|
||||||
for (sitr = SequencedQueue.begin(); sitr != SequencedQueue.end() && count < index; ++sitr, ++count) {
|
for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end() && count < index; ++sitr, ++count) {
|
||||||
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && (((*sitr)->sent_time + timeout) < Timer::GetCurrentTime())) {
|
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && (((*sitr)->sent_time + timeout) < Timer::GetCurrentTime())) {
|
||||||
(*sitr)->sent_time = 0;
|
(*sitr)->sent_time = 0;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck Flagging packet %d for retransmission" __L, SequencedBase + count);
|
Log.Out(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck Flagging packet %d for retransmission" __L, SequencedBase + count);
|
||||||
@ -620,17 +617,19 @@ void EQStream::SequencedPush(EQProtocolPacket *p)
|
|||||||
#else
|
#else
|
||||||
MOutboundQueue.lock();
|
MOutboundQueue.lock();
|
||||||
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L,
|
||||||
|
SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.Out(Logs::Detail, Logs::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L,
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase);
|
NextOutSeq, p->size, SequencedBase);
|
||||||
*(uint16 *)(p->pBuffer) = htons(NextOutSeq);
|
*(uint16 *)(p->pBuffer) = htons(NextOutSeq);
|
||||||
SequencedQueue.push_back(p);
|
SequencedQueue.push_back(p);
|
||||||
NextOutSeq++;
|
NextOutSeq++;
|
||||||
|
|
||||||
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
if (uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
|
Log.Out(Logs::Detail, Logs::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L,
|
||||||
|
SequencedBase, SequencedQueue.size(), NextOutSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
MOutboundQueue.unlock();
|
MOutboundQueue.unlock();
|
||||||
@ -696,8 +695,8 @@ void EQStream::Write(int eq_fd)
|
|||||||
uint16 count = 0;
|
uint16 count = 0;
|
||||||
// get to start of packets
|
// get to start of packets
|
||||||
while (sitr != SequencedQueue.end() && (*sitr)->sent_time > 0) {
|
while (sitr != SequencedQueue.end() && (*sitr)->sent_time > 0) {
|
||||||
sitr++;
|
++sitr;
|
||||||
count++;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop until both are empty or MaxSends is reached
|
// Loop until both are empty or MaxSends is reached
|
||||||
@ -735,9 +734,7 @@ void EQStream::Write(int eq_fd)
|
|||||||
NonSeqEmpty=true;
|
NonSeqEmpty=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sitr != SequencedQueue.end()) {
|
if (sitr != SequencedQueue.end()) {
|
||||||
|
|
||||||
uint16 seq_send = SequencedBase + count; //just for logging...
|
uint16 seq_send = SequencedBase + count; //just for logging...
|
||||||
|
|
||||||
if(SequencedQueue.empty()) {
|
if(SequencedQueue.empty()) {
|
||||||
@ -1362,7 +1359,7 @@ void EQStream::Decay()
|
|||||||
if ((GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) && RETRANSMIT_TIMEOUT_MULT && retransmittimeout) {
|
if ((GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) && RETRANSMIT_TIMEOUT_MULT && retransmittimeout) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
MOutboundQueue.lock();
|
MOutboundQueue.lock();
|
||||||
for (std::deque<EQProtocolPacket *>::iterator sitr = SequencedQueue.begin(); sitr != SequencedQueue.end(); sitr++, count++) {
|
for (auto sitr = SequencedQueue.begin(); sitr != SequencedQueue.end(); ++sitr, count++) {
|
||||||
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && ((*sitr)->sent_time + retransmittimeout) < Timer::GetCurrentTime()) {
|
if (!(*sitr)->acked && (*sitr)->sent_time > 0 && ((*sitr)->sent_time + retransmittimeout) < Timer::GetCurrentTime()) {
|
||||||
(*sitr)->sent_time = 0;
|
(*sitr)->sent_time = 0;
|
||||||
Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout exceeded for seq %d. Flagging packet for retransmission" __L, SequencedBase + count);
|
Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout exceeded for seq %d. Flagging packet for retransmission" __L, SequencedBase + count);
|
||||||
|
|||||||
@ -250,7 +250,6 @@ void EQStreamFactory::CheckTimeout()
|
|||||||
|
|
||||||
void EQStreamFactory::WriterLoop()
|
void EQStreamFactory::WriterLoop()
|
||||||
{
|
{
|
||||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
|
|
||||||
bool havework = true;
|
bool havework = true;
|
||||||
std::vector<std::shared_ptr<EQStream>> wants_write;
|
std::vector<std::shared_ptr<EQStream>> wants_write;
|
||||||
std::vector<std::shared_ptr<EQStream>>::iterator cur, end;
|
std::vector<std::shared_ptr<EQStream>>::iterator cur, end;
|
||||||
@ -274,14 +273,16 @@ void EQStreamFactory::WriterLoop()
|
|||||||
// copy streams into a seperate list so we dont have to keep
|
// copy streams into a seperate list so we dont have to keep
|
||||||
// MStreams locked while we are writting
|
// MStreams locked while we are writting
|
||||||
MStreams.lock();
|
MStreams.lock();
|
||||||
for(stream_itr=Streams.begin();stream_itr!=Streams.end();++stream_itr) {
|
for (auto stream_itr = Streams.begin(); stream_itr != Streams.end(); ++stream_itr) {
|
||||||
// If it's time to decay the bytes sent, then let's do it before we try to write
|
// If it's time to decay the bytes sent, then let's do it before we try to write
|
||||||
if (decay)
|
if (decay)
|
||||||
stream_itr->second->Decay();
|
stream_itr->second->Decay();
|
||||||
|
|
||||||
// bullshit checking, to see if this is really happening, GDB seems to think so...
|
// bullshit checking, to see if this is really happening, GDB seems to think so...
|
||||||
if (stream_itr->second == nullptr) {
|
if (stream_itr->second == nullptr) {
|
||||||
fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i:%i", stream_itr->first.first, stream_itr->first.second);
|
fprintf(stderr,
|
||||||
|
"ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i:%i",
|
||||||
|
stream_itr->first.first, stream_itr->first.second);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user