mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Clean up some auth packet handling related code
This commit is contained in:
parent
00f71c3b9d
commit
a65f6f07f3
9 changed files with 52 additions and 98 deletions
|
@ -183,7 +183,7 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
|
|||
m_access_denied_reason = "Unknown";
|
||||
|
||||
if (pkt->getCommand() != TOCLIENT_ACCESS_DENIED) {
|
||||
// 13/03/15 Legacy code from 0.4.12 and lesser but is still used
|
||||
// Legacy code from 0.4.12 and older but is still used
|
||||
// in some places of the server code
|
||||
if (pkt->getSize() >= 2) {
|
||||
std::wstring wide_reason;
|
||||
|
@ -196,14 +196,14 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
|
|||
if (pkt->getSize() < 1)
|
||||
return;
|
||||
|
||||
u8 denyCode = SERVER_ACCESSDENIED_UNEXPECTED_DATA;
|
||||
u8 denyCode;
|
||||
*pkt >> denyCode;
|
||||
|
||||
if (denyCode == SERVER_ACCESSDENIED_SHUTDOWN ||
|
||||
denyCode == SERVER_ACCESSDENIED_CRASH) {
|
||||
*pkt >> m_access_denied_reason;
|
||||
if (m_access_denied_reason.empty()) {
|
||||
if (m_access_denied_reason.empty())
|
||||
m_access_denied_reason = accessDeniedStrings[denyCode];
|
||||
}
|
||||
u8 reconnect;
|
||||
*pkt >> reconnect;
|
||||
m_access_denied_reconnect = reconnect & 1;
|
||||
|
@ -220,9 +220,8 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
|
|||
// Until then (which may be never), this is outside
|
||||
// of the defined protocol.
|
||||
*pkt >> m_access_denied_reason;
|
||||
if (m_access_denied_reason.empty()) {
|
||||
if (m_access_denied_reason.empty())
|
||||
m_access_denied_reason = "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue