diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-07 12:49:22 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-07 12:49:22 +0200 |
commit | fd08accf52c7329b2cdf1484f17a1842e2961d5e (patch) | |
tree | b192ef0a77a2f6952c1061151358b4f8c5e827f7 /source | |
parent | Fixed a typo in grass spreading causing much of the "too many packets" error. (diff) | |
download | cuberite-fd08accf52c7329b2cdf1484f17a1842e2961d5e.tar cuberite-fd08accf52c7329b2cdf1484f17a1842e2961d5e.tar.gz cuberite-fd08accf52c7329b2cdf1484f17a1842e2961d5e.tar.bz2 cuberite-fd08accf52c7329b2cdf1484f17a1842e2961d5e.tar.lz cuberite-fd08accf52c7329b2cdf1484f17a1842e2961d5e.tar.xz cuberite-fd08accf52c7329b2cdf1484f17a1842e2961d5e.tar.zst cuberite-fd08accf52c7329b2cdf1484f17a1842e2961d5e.zip |
Diffstat (limited to 'source')
-rw-r--r-- | source/cClientHandle.cpp | 11 |
1 files 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();
|