/[svn]/hopm/trunk/src/negcache.c
ViewVC logotype

Diff of /hopm/trunk/src/negcache.c

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

revision 7852 by michael, Sat Nov 5 18:18:08 2016 UTC revision 7853 by michael, Sun Nov 6 18:26:34 2016 UTC
# Line 57  negcache_init(void) Line 57  negcache_init(void)
57      /* Cache already exists */      /* Cache already exists */
58      return;      return;
59    
60    negcache_trie = New_Patricia(PATRICIA_MAXBITS);    negcache_trie = patricia_new(PATRICIA_MAXBITS);
61    negcache_list = list_create();    negcache_list = list_create();
62  }  }
63    
# Line 71  check_neg_cache(const char *ipstr) Line 71  check_neg_cache(const char *ipstr)
71    if (OptionsItem->negcache == 0)    if (OptionsItem->negcache == 0)
72      return NULL;      return NULL;
73    
74    patricia_node_t *pnode = try_search_exact(negcache_trie, ipstr);    patricia_node_t *pnode = patricia_try_search_exact(negcache_trie, ipstr);
75    if (pnode)    if (pnode)
76    {    {
77      struct negcache_item *n = pnode->data;      struct negcache_item *n = pnode->data;
# Line 90  check_neg_cache(const char *ipstr) Line 90  check_neg_cache(const char *ipstr)
90  void  void
91  negcache_insert(const char *ipstr)  negcache_insert(const char *ipstr)
92  {  {
93    patricia_node_t *pnode = make_and_lookup(negcache_trie, ipstr);    patricia_node_t *pnode = patricia_make_and_lookup(negcache_trie, ipstr);
94    if (!pnode || pnode->data)    if (!pnode || pnode->data)
95      return;  /* Malformed IP address or already added to the trie */      return;  /* Malformed IP address or already added to the trie */
96    
# Line 118  negcache_rebuild(void) Line 118  negcache_rebuild(void)
118      {      {
119        if (OPT_DEBUG >= 2)        if (OPT_DEBUG >= 2)
120          log_printf("NEGCACHE -> Deleting expired negcache node for %s added at %lu",          log_printf("NEGCACHE -> Deleting expired negcache node for %s added at %lu",
121                     prefix_toa(pnode->prefix), n->seen);                     patricia_prefix_toa(pnode->prefix, 0), n->seen);
122    
123        list_remove(negcache_list, node);        list_remove(negcache_list, node);
124        node_free(node);        node_free(node);

Legend:
Removed from v.7852  
changed lines
  Added in v.7853

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