added: to 'ipban' winix function:
possibility to remove a ban (or all bans) added: to SessionManager: sorting of the ban list (in the second thread) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@903 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
IPBanContainer::IPBanContainer()
|
||||
{
|
||||
is_ipban_tab_sorted = false;
|
||||
is_ipban_tab_sorted = true; // an empty list is sorted
|
||||
soft_max_size = 100;
|
||||
max_size = 110;
|
||||
}
|
||||
@@ -49,6 +49,7 @@ IPBan & IPBanContainer::AddIP(int ip)
|
||||
RemoveOldRecords();
|
||||
|
||||
ipban_tab.push_back(ip_ban);
|
||||
is_ipban_tab_sorted = false;
|
||||
return ipban_tab.back();
|
||||
}
|
||||
else
|
||||
@@ -58,6 +59,31 @@ IPBan & IPBanContainer::AddIP(int ip)
|
||||
}
|
||||
|
||||
|
||||
void IPBanContainer::RemoveIP(int ip)
|
||||
{
|
||||
IPBan * ipban = FindIP(ip);
|
||||
|
||||
if( ipban )
|
||||
{
|
||||
size_t index = ipban - &ipban_tab[0];
|
||||
ipban_tab.erase(ipban_tab.begin() + index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool IPBanContainer::IsSorted()
|
||||
{
|
||||
return is_ipban_tab_sorted;
|
||||
}
|
||||
|
||||
|
||||
void IPBanContainer::Clear()
|
||||
{
|
||||
ipban_tab.clear();
|
||||
is_ipban_tab_sorted = true;
|
||||
}
|
||||
|
||||
|
||||
// we need to remove some old records for the size of the container
|
||||
// to be less or equal to soft_max_size
|
||||
void IPBanContainer::RemoveOldRecords()
|
||||
|
Reference in New Issue
Block a user