Bug fix
This commit is contained in:
@@ -190,8 +190,21 @@ void cProtocolRecognizer::SendDestroyEntity(const cEntity & a_Entity)
|
||||
|
||||
void cProtocolRecognizer::SendDisconnect(const AString & a_Reason)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendDisconnect(a_Reason);
|
||||
if (m_Protocol != NULL)
|
||||
{
|
||||
m_Protocol->SendDisconnect(a_Reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is used when the client sends a server-ping, respond with the default packet:
|
||||
static const int Packet = 0xff; // PACKET_DISCONNECT
|
||||
SendData((const char *)&Packet, 1); // WriteByte()
|
||||
|
||||
AString & UTF16 = UTF8ToRawBEUTF16(a_Reason.c_str(), a_Reason.length());
|
||||
static const short Size = htons((short)(UTF16.size() / 2));
|
||||
SendData((const char *)&Size, 2); // WriteShort()
|
||||
SendData(UTF16.data(), UTF16.size()); // WriteString()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user