From fd08accf52c7329b2cdf1484f17a1842e2961d5e Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 7 Jun 2012 10:49:22 +0000 Subject: Multiple packets are serialized in one request. git-svn-id: http://mc-server.googlecode.com/svn/trunk@568 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 24c732185..966270321 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -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 -#define MAX_OUTGOING_PACKETS 10000 +#define MAX_OUTGOING_PACKETS 2000 @@ -1992,13 +1990,16 @@ void cClientHandle::GetOutgoingData(AString & a_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); delete m_PendingNrmSendPackets.front(); 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); delete m_PendingLowSendPackets.front(); -- cgit v1.2.3