summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-05 20:05:15 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-05 20:05:15 +0100
commit2e64b2e5f53239c47431710d2e5d97a26eaf8fd3 (patch)
treefd8134c7e75112336907dfb022b75620d89ee216 /source
parentFloody fluid simulator can create sourceblocks (configurable in World.ini) (diff)
downloadcuberite-2e64b2e5f53239c47431710d2e5d97a26eaf8fd3.tar
cuberite-2e64b2e5f53239c47431710d2e5d97a26eaf8fd3.tar.gz
cuberite-2e64b2e5f53239c47431710d2e5d97a26eaf8fd3.tar.bz2
cuberite-2e64b2e5f53239c47431710d2e5d97a26eaf8fd3.tar.lz
cuberite-2e64b2e5f53239c47431710d2e5d97a26eaf8fd3.tar.xz
cuberite-2e64b2e5f53239c47431710d2e5d97a26eaf8fd3.tar.zst
cuberite-2e64b2e5f53239c47431710d2e5d97a26eaf8fd3.zip
Diffstat (limited to '')
-rw-r--r--source/ClientHandle.cpp15
-rw-r--r--source/ClientHandle.h3
2 files changed, 11 insertions, 7 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp
index 36a84ad41..dff95d89c 100644
--- a/source/ClientHandle.cpp
+++ b/source/ClientHandle.cpp
@@ -79,7 +79,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance)
, m_IPString(a_Socket->GetIPString())
, m_OutgoingData(64 KiB)
, m_Player(NULL)
- , m_bKicking(false)
+ , m_HasSentDC(false)
, m_TimeSinceLastPacket(0)
, m_bKeepThreadGoing(true)
, m_Ping(1000)
@@ -140,7 +140,7 @@ cClientHandle::~cClientHandle()
}
}
- if (!m_bKicking)
+ if (!m_HasSentDC)
{
SendDisconnect("Server shut down? Kthnxbai");
}
@@ -200,7 +200,6 @@ void cClientHandle::Kick(const AString & a_Reason)
LOG("Kicking user \"%s\" for \"%s\"", m_Username.c_str(), a_Reason.c_str());
}
SendDisconnect(a_Reason);
- m_bKicking = true;
}
@@ -1151,8 +1150,12 @@ void cClientHandle::Tick(float a_Dt)
void cClientHandle::SendDisconnect(const AString & a_Reason)
{
- LOGD("Sending a DC: \"%s\"", a_Reason.c_str());
- m_Protocol->SendDisconnect(a_Reason);
+ if (!m_HasSentDC)
+ {
+ LOGD("Sending a DC: \"%s\"", a_Reason.c_str());
+ m_Protocol->SendDisconnect(a_Reason);
+ m_HasSentDC = true;
+ }
}
@@ -1768,7 +1771,7 @@ void cClientHandle::GetOutgoingData(AString & a_Data)
}
// Disconnect player after all packets have been sent
- if (m_bKicking && a_Data.empty())
+ if (m_HasSentDC && a_Data.empty())
{
Destroy();
}
diff --git a/source/ClientHandle.h b/source/ClientHandle.h
index cf02bd107..806224333 100644
--- a/source/ClientHandle.h
+++ b/source/ClientHandle.h
@@ -204,7 +204,8 @@ private:
Vector3d m_ConfirmPosition;
cPlayer * m_Player;
- bool m_bKicking;
+
+ bool m_HasSentDC;
// Chunk position when the last StreamChunks() was called; used to avoid re-streaming while in the same chunk
int m_LastStreamedChunkX;