From 8a08b3d3b7721390760a37a82d654be291accaf4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 28 Jun 2021 22:05:36 +0100 Subject: [PATCH] Remove outdated comment and redundant check Refactoring made the comment no longer true. The check isn't needed since no packets are sent, and Destroy does nothing, if m_HasSentDC. --- src/ClientHandle.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index eac73e4ab..2e50c669b 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2440,15 +2440,11 @@ void cClientHandle::SendDetachEntity(const cEntity & a_Entity, const cEntity & a void cClientHandle::SendDisconnect(const AString & a_Reason) { - // Destruction (Destroy()) is called when the client disconnects, not when a disconnect packet (or anything else) is sent - // Otherwise, the cClientHandle instance is can be unexpectedly removed from the associated player - Core/#142 - if (!m_HasSentDC) - { - LOGD("Sending a DC: \"%s\"", StripColorCodes(a_Reason).c_str()); - m_Protocol.SendDisconnect(*this, a_Reason); - m_HasSentDC = true; - Destroy(); - } + LOGD("Sending a DC: \"%s\"", StripColorCodes(a_Reason).c_str()); + + m_Protocol.SendDisconnect(*this, a_Reason); + m_HasSentDC = true; + Destroy(); }