[Master] Add ban/unban functions

This commit is contained in:
Koncord 2017-09-12 20:24:50 +08:00
parent 26324c2578
commit fc8232f943
2 changed files with 15 additions and 0 deletions

View file

@ -234,3 +234,15 @@ MasterServer::ServerMap *MasterServer::GetServers()
{ {
return &servers; return &servers;
} }
void MasterServer::ban(const std::string &addr)
{
banned.push_back(addr);
}
void MasterServer::unban(const std::string &addr)
{
auto it = find(banned.begin(), banned.end(), addr);
if (it != banned.end())
banned.erase(it);
}

View file

@ -31,6 +31,9 @@ public:
ServerMap* GetServers(); ServerMap* GetServers();
void ban(const std::string &addr);
void unban(const std::string &addr);
private: private:
void Thread(); void Thread();