summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;