mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Check for duplicate login in TOSERVER_INIT handler (#11017)
i.e. checks for duplicate logins before sending all media data to the client.
This commit is contained in:
parent
59a1b53d67
commit
492110a640
1 changed files with 10 additions and 0 deletions
|
@ -174,6 +174,16 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RemotePlayer *player = m_env->getPlayer(playername);
|
||||||
|
|
||||||
|
// If player is already connected, cancel
|
||||||
|
if (player && player->getPeerId() != PEER_ID_INEXISTENT) {
|
||||||
|
actionstream << "Server: Player with name \"" << playername <<
|
||||||
|
"\" tried to connect, but player with same name is already connected" << std::endl;
|
||||||
|
DenyAccess(peer_id, SERVER_ACCESSDENIED_ALREADY_CONNECTED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_clients.setPlayerName(peer_id, playername);
|
m_clients.setPlayerName(peer_id, playername);
|
||||||
//TODO (later) case insensitivity
|
//TODO (later) case insensitivity
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue