summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-01-17 16:13:32 +0100
committerTiger Wang <ziwei.tiger@outlook.com>2021-01-19 10:54:58 +0100
commit49ef21d6505c76fb26d50c99934e801ba6016049 (patch)
tree85fb980259f4ae19fc66cba27bbba24f6ffc713c /src/ClientHandle.cpp
parentcChunk: don't inherit from cChunkDef (#5106) (diff)
downloadcuberite-49ef21d6505c76fb26d50c99934e801ba6016049.tar
cuberite-49ef21d6505c76fb26d50c99934e801ba6016049.tar.gz
cuberite-49ef21d6505c76fb26d50c99934e801ba6016049.tar.bz2
cuberite-49ef21d6505c76fb26d50c99934e801ba6016049.tar.lz
cuberite-49ef21d6505c76fb26d50c99934e801ba6016049.tar.xz
cuberite-49ef21d6505c76fb26d50c99934e801ba6016049.tar.zst
cuberite-49ef21d6505c76fb26d50c99934e801ba6016049.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index ffb968a0c..9d236e4d5 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1981,14 +1981,7 @@ void cClientHandle::Tick(float a_Dt)
m_BreakProgress += m_Player->GetMiningProgressPerTick(Block);
}
- try
- {
- ProcessProtocolIn();
- }
- catch (const std::exception & Oops)
- {
- Kick(Oops.what());
- }
+ ProcessProtocolIn();
if (IsDestroyed())
{
@@ -3171,7 +3164,7 @@ void cClientHandle::PacketBufferFull(void)
{
// Too much data in the incoming queue, the server is probably too busy, kick the client:
LOGERROR("Too much data in queue for client \"%s\" @ %s, kicking them.", m_Username.c_str(), m_IPString.c_str());
- SendDisconnect("Server busy");
+ SendDisconnect("The server is busy; please try again later.");
}
@@ -3249,10 +3242,19 @@ void cClientHandle::ProcessProtocolIn(void)
std::swap(IncomingData, m_IncomingData);
}
- if (!IncomingData.empty())
+ if (IncomingData.empty())
+ {
+ return;
+ }
+
+ try
{
m_Protocol.HandleIncomingData(*this, IncomingData);
}
+ catch (const std::exception & Oops)
+ {
+ Kick(Oops.what());
+ }
}