/[svn]/ircd-hybrid/trunk/src/conf.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/src/conf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1653  
changed lines
  Added in v.1654

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28