25 |
|
#include "stdinc.h" |
26 |
|
#include "list.h" |
27 |
|
#include "ircd_defs.h" |
28 |
– |
#include "balloc.h" |
28 |
|
#include "conf.h" |
29 |
|
#include "s_serv.h" |
30 |
|
#include "resv.h" |
44 |
|
#include "send.h" |
45 |
|
#include "s_gline.h" |
46 |
|
#include "memory.h" |
47 |
+ |
#include "mempool.h" |
48 |
|
#include "irc_res.h" |
49 |
|
#include "userhost.h" |
50 |
|
#include "s_user.h" |
104 |
|
}; |
105 |
|
|
106 |
|
static struct ip_entry *ip_hash_table[IP_HASH_SIZE]; |
107 |
< |
static BlockHeap *ip_entry_heap = NULL; |
107 |
> |
static mp_pool_t *ip_entry_pool = NULL; |
108 |
|
static int ip_entries_count = 0; |
109 |
|
|
110 |
|
|
654 |
|
void |
655 |
|
init_ip_hash_table(void) |
656 |
|
{ |
657 |
< |
ip_entry_heap = BlockHeapCreate("ip", sizeof(struct ip_entry), |
657 |
> |
ip_entry_pool = mp_pool_new(sizeof(struct ip_entry), |
658 |
|
2 * hard_fdlimit); |
659 |
|
memset(ip_hash_table, 0, sizeof(ip_hash_table)); |
660 |
|
} |
704 |
|
if (ip_entries_count >= 2 * hard_fdlimit) |
705 |
|
garbage_collect_ip_entries(); |
706 |
|
|
707 |
< |
newptr = BlockHeapAlloc(ip_entry_heap); |
707 |
> |
newptr = mp_pool_get(ip_entry_pool); |
708 |
> |
memset(newptr, 0, sizeof(*newptr)); |
709 |
|
ip_entries_count++; |
710 |
|
memcpy(&newptr->ip, ip_in, sizeof(struct irc_ssaddr)); |
711 |
|
|
763 |
|
else |
764 |
|
ip_hash_table[hash_index] = ptr->next; |
765 |
|
|
766 |
< |
BlockHeapFree(ip_entry_heap, ptr); |
766 |
> |
mp_pool_release(ptr); |
767 |
|
ip_entries_count--; |
768 |
|
return; |
769 |
|
} |
866 |
|
last_ptr->next = ptr->next; |
867 |
|
else |
868 |
|
ip_hash_table[i] = ptr->next; |
869 |
< |
BlockHeapFree(ip_entry_heap, ptr); |
869 |
> |
mp_pool_release(ptr); |
870 |
|
ip_entries_count--; |
871 |
|
} |
872 |
|
else |
1078 |
|
DLINK_FOREACH(ptr, list_p->head) |
1079 |
|
{ |
1080 |
|
conf = ptr->data; |
1081 |
< |
assert(conf->regexpname); |
1081 |
> |
assert(conf->regexuser); |
1082 |
|
|
1083 |
|
if (!ircd_pcre_exec(conf->regexuser, name)) |
1084 |
|
return conf; |