1
0

Multiple packets are serialized in one request.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@568 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-06-07 10:49:22 +00:00
parent 508d5d6e12
commit fd08accf52

View File

@ -82,10 +82,8 @@
// TODO: Temporarily set to higher value, the advances in blockticking made this a needed change until a better solution is implemented.
// Ref.: http://forum.mc-server.org/showthread.php?tid=471 )
/// If the number of queued outgoing packets reaches this, the client will be kicked /// If the number of queued outgoing packets reaches this, the client will be kicked
#define MAX_OUTGOING_PACKETS 10000 #define MAX_OUTGOING_PACKETS 2000
@ -1992,13 +1990,16 @@ void cClientHandle::GetOutgoingData(AString & a_Data)
} }
AString Data; AString Data;
if (!m_PendingNrmSendPackets.empty()) Data.reserve(1100);
// Serialize normal-priority packets up to 1000 bytes
while (!m_PendingNrmSendPackets.empty() && (Data.size() < 1000))
{ {
m_PendingNrmSendPackets.front()->Serialize(Data); m_PendingNrmSendPackets.front()->Serialize(Data);
delete m_PendingNrmSendPackets.front(); delete m_PendingNrmSendPackets.front();
m_PendingNrmSendPackets.erase(m_PendingNrmSendPackets.begin()); m_PendingNrmSendPackets.erase(m_PendingNrmSendPackets.begin());
} }
else if (!m_PendingLowSendPackets.empty()) // Serialize one low-priority packet:
if (!m_PendingLowSendPackets.empty() && Data.empty())
{ {
m_PendingLowSendPackets.front()->Serialize(Data); m_PendingLowSendPackets.front()->Serialize(Data);
delete m_PendingLowSendPackets.front(); delete m_PendingLowSendPackets.front();