summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-03-28 22:20:13 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2021-03-28 22:20:13 +0200
commitabcc14076cc0792644d7e3abf434421369f03a75 (patch)
treea7d3cb18181d5a5473b007d192bf3e4989a96289 /src/ClientHandle.cpp
parentSend keep alives slightly less frequently (diff)
downloadcuberite-abcc14076cc0792644d7e3abf434421369f03a75.tar
cuberite-abcc14076cc0792644d7e3abf434421369f03a75.tar.gz
cuberite-abcc14076cc0792644d7e3abf434421369f03a75.tar.bz2
cuberite-abcc14076cc0792644d7e3abf434421369f03a75.tar.lz
cuberite-abcc14076cc0792644d7e3abf434421369f03a75.tar.xz
cuberite-abcc14076cc0792644d7e3abf434421369f03a75.tar.zst
cuberite-abcc14076cc0792644d7e3abf434421369f03a75.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 0b99cd95c..04436070c 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -130,8 +130,9 @@ void cClientHandle::Destroy(void)
{
cCSLock Lock(m_CSOutgoingData);
- m_Link->Shutdown(); // Cleanly close the connection
- m_Link.reset(); // Release the strong reference cTCPLink holds to ourself
+ m_Link->Send(m_OutgoingData.data(), m_OutgoingData.size()); // Flush remaining data.
+ m_Link->Shutdown(); // Cleanly close the connection.
+ m_Link.reset(); // Release the strong reference cTCPLink holds to ourself.
}
}
@@ -1933,9 +1934,12 @@ void cClientHandle::RemoveFromWorld(void)
m_SentChunks.clear();
}
+ // Flush outgoing data:
+ ProcessProtocolOut();
+
// No need to send Unload Chunk packets, the client unloads automatically.
- // Here, we set last streamed values to bogus ones so everything is resent
+ // Here, we set last streamed values to bogus ones so everything is resent:
m_LastStreamedChunkX = 0x7fffffff;
m_LastStreamedChunkZ = 0x7fffffff;
}
@@ -2105,6 +2109,7 @@ void cClientHandle::Tick(float a_Dt)
void cClientHandle::ServerTick(float a_Dt)
{
ProcessProtocolIn();
+ ProcessProtocolOut();
m_TicksSinceLastPacket += 1;
if (m_TicksSinceLastPacket > 600) // 30 seconds