added: locales to fun_ipban.html

changed: cosmetic changes in IPBanContainer




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@904 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-10-27 10:14:07 +00:00
parent 9ef3736989
commit 8033ac66c4
9 changed files with 74 additions and 32 deletions

View File

@@ -88,8 +88,6 @@ void IPBanContainer::Clear()
// to be less or equal to soft_max_size
void IPBanContainer::RemoveOldRecords()
{
PrintTab();
size_t to_remove = 0;
if( ipban_tab.size() >= soft_max_size )
@@ -97,35 +95,22 @@ void IPBanContainer::RemoveOldRecords()
if( to_remove > 0 )
{
log << log4 << "we are going to remove: " << to_remove << " records" << logend;
sort_helper_tab.resize(ipban_tab.size());
for(size_t i=0 ; i<ipban_tab.size() ; ++i)
sort_helper_tab[i] = i;
std::sort(sort_helper_tab.begin(), sort_helper_tab.end(), SortByLastUsedHelper(this));
PrintTab2();
sort_helper_tab.resize(to_remove);
std::sort(sort_helper_tab.begin(), sort_helper_tab.end());
PrintTab2();
while( to_remove-- > 0 )
{
log << log4 << "removing record index: " << sort_helper_tab[to_remove] << ", last_used: ";
PT::Date date(ipban_tab[sort_helper_tab[to_remove]].last_used);
log << date << logend;
ipban_tab.erase(ipban_tab.begin() + sort_helper_tab[to_remove]);
}
log << log4 << "after removing we have: " << logend;
PrintTab();
}
}
// for debug purposes
void IPBanContainer::PrintTab()
{
log << log4 << "ipban_tab (size: " << ipban_tab.size() << ")" << logend;
@@ -142,6 +127,8 @@ void IPBanContainer::PrintTab()
}
}
// for debug purposes
void IPBanContainer::PrintTab2()
{
log << log4 << "sort_helper_tab (size: " << sort_helper_tab.size() << ")" << logend;