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

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

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

revision 9859 by michael, Fri Jan 1 04:43:22 2021 UTC revision 9860 by michael, Fri Jan 1 08:52:01 2021 UTC
# Line 609  res_readreply(fde_t *F, void *data) Line 609  res_readreply(fde_t *F, void *data)
609   * timeout_query_list - Remove queries from the list which have been   * timeout_query_list - Remove queries from the list which have been
610   * there too long without being resolved.   * there too long without being resolved.
611   */   */
612  static uintmax_t  static void
613  timeout_query_list(void)  resolver_timeout(void *unused)
614  {  {
615    dlink_node *node, *node_next;    dlink_node *node, *node_next;
   uintmax_t next_time = 0;  
616    
617    DLINK_FOREACH_SAFE(node, node_next, request_list.head)    DLINK_FOREACH_SAFE(node, node_next, request_list.head)
618    {    {
# Line 626  timeout_query_list(void) Line 625  timeout_query_list(void)
625        {        {
626          (*request->callback)(request->callback_ctx, NULL, NULL, 0);          (*request->callback)(request->callback_ctx, NULL, NULL, 0);
627          rem_request(request);          rem_request(request);
         continue;  
628        }        }
629        else        else
630        {        {
# Line 635  timeout_query_list(void) Line 633  timeout_query_list(void)
633          resend_query(request);          resend_query(request);
634        }        }
635      }      }
   
     if (next_time == 0 || timeout < next_time)  
       next_time = timeout;  
636    }    }
   
   return (next_time > event_base->time.sec_monotonic) ? next_time : (event_base->time.sec_monotonic + AR_TTL);  
 }  
   
 /*  
  * timeout_resolver - check request list  
  */  
 static void  
 timeout_resolver(void *unused)  
 {  
   timeout_query_list();  
637  }  }
638    
639  /*  /*
# Line 658  timeout_resolver(void *unused) Line 642  timeout_resolver(void *unused)
642  void  void
643  resolver_init(void)  resolver_init(void)
644  {  {
645    static struct event event_timeout_resolver =    static struct event resolver_timeout_event =
646    {    {
647      .name = "timeout_resolver",      .name = "resolver_timeout",
648      .handler = timeout_resolver,      .handler = resolver_timeout,
649      .when = 1      .when = 1
650    };    };
651    
652    start_resolver();    start_resolver();
653    event_add(&event_timeout_resolver, NULL);    event_add(&resolver_timeout_event, NULL);
654  }  }

Legend:
Removed from v.9859  
changed lines
  Added in v.9860

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