/[svn]/ircd-hybrid-7.2/src/irc_res.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/src/irc_res.c

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

revision 997 by michael, Fri Aug 21 10:25:40 2009 UTC revision 998 by michael, Sun Aug 23 12:43:17 2009 UTC
# Line 21  Line 21 
21    
22  #include "stdinc.h"  #include "stdinc.h"
23  #include "tools.h"  #include "tools.h"
24    #include "balloc.h"
25  #include "client.h"  #include "client.h"
26  #include "list.h"  #include "list.h"
27  #include "common.h"  #include "common.h"
# Line 94  struct reslist Line 95  struct reslist
95    
96  static fde_t ResolverFileDescriptor;  static fde_t ResolverFileDescriptor;
97  static dlink_list request_list = { NULL, NULL, 0 };  static dlink_list request_list = { NULL, NULL, 0 };
98    static BlockHeap *dns_heap = NULL;
99    
100  static void rem_request(struct reslist *request);  static void rem_request(struct reslist *request);
101  static struct reslist *make_request(dns_callback_fnc callback, void *);  static struct reslist *make_request(dns_callback_fnc callback, void *);
# Line 252  start_resolver(void) Line 254  start_resolver(void)
254  void  void
255  init_resolver(void)  init_resolver(void)
256  {  {
257      dns_heap = BlockHeapCreate("dns", sizeof(struct reslist), DNS_HEAP_SIZE);
258    memset(&ResolverFileDescriptor, 0, sizeof(fde_t));    memset(&ResolverFileDescriptor, 0, sizeof(fde_t));
259    start_resolver();    start_resolver();
260  }  }
# Line 276  static void Line 279  static void
279  rem_request(struct reslist *request)  rem_request(struct reslist *request)
280  {  {
281    dlinkDelete(&request->node, &request_list);    dlinkDelete(&request->node, &request_list);
282    
283    MyFree(request->name);    MyFree(request->name);
284    MyFree(request);    BlockHeapFree(dns_heap, request);
285  }  }
286    
287  /*  /*
# Line 286  rem_request(struct reslist *request) Line 290  rem_request(struct reslist *request)
290  static struct reslist *  static struct reslist *
291  make_request(dns_callback_fnc callback, void *ctx)  make_request(dns_callback_fnc callback, void *ctx)
292  {  {
293    struct reslist *request;    struct reslist *request = BlockHeapAlloc(dns_heap);
   
   request = (struct reslist *)MyMalloc(sizeof(struct reslist));  
294    
295    request->sentat       = CurrentTime;    request->sentat       = CurrentTime;
296    request->retries      = 3;    request->retries      = 3;
# Line 299  make_request(dns_callback_fnc callback, Line 301  make_request(dns_callback_fnc callback,
301    request->callback_ctx = ctx;    request->callback_ctx = ctx;
302    
303    dlinkAdd(request, &request->node, &request_list);    dlinkAdd(request, &request->node, &request_list);
304    return(request);    return request;
305  }  }
306    
307  /*  /*
# Line 413  do_query_name(dns_callback_fnc callback, Line 415  do_query_name(dns_callback_fnc callback,
415  {  {
416    char host_name[HOSTLEN + 1];    char host_name[HOSTLEN + 1];
417    
418    strlcpy(host_name, name, sizeof(hostname));    strlcpy(host_name, name, sizeof(host_name));
419    
420    if (request == NULL)    if (request == NULL)
421    {    {

Legend:
Removed from v.997  
changed lines
  Added in v.998

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