mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix server getting completely choked up on even a little of DoS
* If client count is unbearable, immediately delete denied clients * Re-prioritize the checking order of things about incoming clients * Remove a huge CPU-wasting exception in ReliablePacketBuffer
This commit is contained in:
parent
8831669505
commit
e6687be493
4 changed files with 229 additions and 168 deletions
16
src/server.h
16
src/server.h
|
@ -250,6 +250,8 @@ public:
|
|||
|
||||
bool definitions_sent;
|
||||
|
||||
bool denied;
|
||||
|
||||
RemoteClient():
|
||||
m_time_from_building(9999),
|
||||
m_excess_gotblocks(0)
|
||||
|
@ -259,6 +261,7 @@ public:
|
|||
net_proto_version = 0;
|
||||
pending_serialization_version = SER_FMT_VER_INVALID;
|
||||
definitions_sent = false;
|
||||
denied = false;
|
||||
m_nearest_unsent_d = 0;
|
||||
m_nearest_unsent_reset_timer = 0.0;
|
||||
m_nothing_to_send_counter = 0;
|
||||
|
@ -589,7 +592,7 @@ private:
|
|||
void SendHUDChange(u16 peer_id, u32 id, HudElementStat stat, void *value);
|
||||
void SendHUDSetFlags(u16 peer_id, u32 flags, u32 mask);
|
||||
void SendHUDSetParam(u16 peer_id, u16 param, const std::string &value);
|
||||
|
||||
|
||||
/*
|
||||
Send a node removal/addition event to all clients except ignore_id.
|
||||
Additionally, if far_players!=NULL, players further away than
|
||||
|
@ -658,11 +661,20 @@ private:
|
|||
|
||||
void DiePlayer(u16 peer_id);
|
||||
void RespawnPlayer(u16 peer_id);
|
||||
void DenyAccess(u16 peer_id, const std::wstring &reason);
|
||||
|
||||
enum ClientDeletionReason {
|
||||
CDR_LEAVE,
|
||||
CDR_TIMEOUT,
|
||||
CDR_DENY
|
||||
};
|
||||
void DeleteClient(u16 peer_id, ClientDeletionReason reason);
|
||||
|
||||
void UpdateCrafting(u16 peer_id);
|
||||
|
||||
// When called, connection mutex should be locked
|
||||
RemoteClient* getClient(u16 peer_id);
|
||||
RemoteClient* getClientNoEx(u16 peer_id);
|
||||
|
||||
// When called, environment mutex should be locked
|
||||
std::string getPlayerName(u16 peer_id)
|
||||
|
@ -737,7 +749,7 @@ private:
|
|||
std::map<u16, RemoteClient*> m_clients;
|
||||
u16 m_clients_number; //for announcing masterserver
|
||||
|
||||
// Bann checking
|
||||
// Ban checking
|
||||
BanManager m_banmanager;
|
||||
|
||||
// Rollback manager (behind m_env_mutex)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue