mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-11 13:02:25 +00:00
Change clientpackets to std::deque from LinkedList
This should be better performance, but I couldn't really push local testing to hit the performance issues ...
This commit is contained in:
parent
757c7f5b00
commit
34549a4bdb
@ -697,12 +697,13 @@ bool Client::AddPacket(const EQApplicationPacket *pApp, bool bAckreq) {
|
|||||||
//drop the packet because it will never get sent.
|
//drop the packet because it will never get sent.
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
auto c = new CLIENTPACKET;
|
|
||||||
|
auto c = std::unique_ptr<CLIENTPACKET>(new CLIENTPACKET);
|
||||||
|
|
||||||
c->ack_req = bAckreq;
|
c->ack_req = bAckreq;
|
||||||
c->app = pApp->Copy();
|
c->app = pApp->Copy();
|
||||||
|
|
||||||
clientpackets.Append(c);
|
clientpackets.push_back(std::move(c));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,26 +715,23 @@ bool Client::AddPacket(EQApplicationPacket** pApp, bool bAckreq) {
|
|||||||
//drop the packet because it will never get sent.
|
//drop the packet because it will never get sent.
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
auto c = new CLIENTPACKET;
|
auto c = std::unique_ptr<CLIENTPACKET>(new CLIENTPACKET);
|
||||||
|
|
||||||
c->ack_req = bAckreq;
|
c->ack_req = bAckreq;
|
||||||
c->app = *pApp;
|
c->app = *pApp;
|
||||||
*pApp = nullptr;
|
*pApp = nullptr;
|
||||||
|
|
||||||
clientpackets.Append(c);
|
clientpackets.push_back(std::move(c));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::SendAllPackets() {
|
bool Client::SendAllPackets() {
|
||||||
LinkedListIterator<CLIENTPACKET*> iterator(clientpackets);
|
|
||||||
|
|
||||||
CLIENTPACKET* cp = nullptr;
|
CLIENTPACKET* cp = nullptr;
|
||||||
iterator.Reset();
|
while (!clientpackets.empty()) {
|
||||||
while(iterator.MoreElements()) {
|
cp = clientpackets.front().get();
|
||||||
cp = iterator.GetData();
|
|
||||||
if(eqs)
|
if(eqs)
|
||||||
eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req);
|
eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req);
|
||||||
iterator.RemoveCurrent();
|
clientpackets.pop_front();
|
||||||
Log(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
|
Log(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -70,6 +70,7 @@ namespace EQEmu
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
|
||||||
#define CLIENT_TIMEOUT 90000
|
#define CLIENT_TIMEOUT 90000
|
||||||
@ -1424,7 +1425,7 @@ private:
|
|||||||
bool AddPacket(const EQApplicationPacket *, bool);
|
bool AddPacket(const EQApplicationPacket *, bool);
|
||||||
bool AddPacket(EQApplicationPacket**, bool);
|
bool AddPacket(EQApplicationPacket**, bool);
|
||||||
bool SendAllPackets();
|
bool SendAllPackets();
|
||||||
LinkedList<CLIENTPACKET *> clientpackets;
|
std::deque<std::unique_ptr<CLIENTPACKET>> clientpackets;
|
||||||
|
|
||||||
//Zoning related stuff
|
//Zoning related stuff
|
||||||
void SendZoneCancel(ZoneChange_Struct *zc);
|
void SendZoneCancel(ZoneChange_Struct *zc);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user