mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 02:08:20 +00:00
Resolve missing RakNet replacement (#650)
Repair issue from PR earlier, crucial fix.
This commit is contained in:
parent
c689b3d3d1
commit
0d4f86b20b
@ -817,19 +817,27 @@ void HandlePacket(Packet* packet) {
|
|||||||
RakNet::BitStream inStream(packet->data, packet->length, false);
|
RakNet::BitStream inStream(packet->data, packet->length, false);
|
||||||
uint64_t header = inStream.Read(header);
|
uint64_t header = inStream.Read(header);
|
||||||
uint32_t sessionKey = inStream.Read(sessionKey);
|
uint32_t sessionKey = inStream.Read(sessionKey);
|
||||||
RakNet::RakString username;
|
|
||||||
inStream.Read(username);
|
std::string username;
|
||||||
|
|
||||||
|
uint32_t len;
|
||||||
|
inStream.Read(len);
|
||||||
|
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
char character; inStream.Read<char>(character);
|
||||||
|
username += character;
|
||||||
|
}
|
||||||
|
|
||||||
//Find them:
|
//Find them:
|
||||||
User* user = UserManager::Instance()->GetUser(username.C_String());
|
User* user = UserManager::Instance()->GetUser(username.c_str());
|
||||||
if (!user) {
|
if (!user) {
|
||||||
Game::logger->Log("WorldServer", "Got new session alert for user %s, but they're not logged in.\n", username.C_String());
|
Game::logger->Log("WorldServer", "Got new session alert for user %s, but they're not logged in.\n", username.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check the key:
|
//Check the key:
|
||||||
if (sessionKey != std::atoi(user->GetSessionKey().c_str())) {
|
if (sessionKey != std::atoi(user->GetSessionKey().c_str())) {
|
||||||
Game::logger->Log("WorldServer", "Got new session alert for user %s, but the session key is invalid.\n", username.C_String());
|
Game::logger->Log("WorldServer", "Got new session alert for user %s, but the session key is invalid.\n", username.c_str());
|
||||||
Game::server->Disconnect(user->GetSystemAddress(), SERVER_DISCON_INVALID_SESSION_KEY);
|
Game::server->Disconnect(user->GetSystemAddress(), SERVER_DISCON_INVALID_SESSION_KEY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user