ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf.c
(Generate patch)

Comparing ircd-hybrid-8/src/conf.c (file contents):
Revision 1383 by michael, Tue May 1 11:18:22 2012 UTC vs.
Revision 1387 by michael, Tue May 1 11:50:01 2012 UTC

# Line 2683 | Line 2683 | get_conf_ping(struct ConfItem *conf, int
2683   const char *
2684   get_client_class(struct Client *target_p)
2685   {
2686 <  dlink_node *ptr;
2687 <  struct ConfItem *conf;
2688 <  struct AccessItem *aconf;
2686 >  dlink_node *cnode = NULL;
2687 >  struct AccessItem *aconf = NULL;
2688 >
2689 >  assert(!IsMe(target_p));
2690  
2691 <  if (target_p != NULL && !IsMe(target_p) &&
2691 <      target_p->localClient->confs.head != NULL)
2691 >  if ((cnode = target_p->localClient->confs.head))
2692    {
2693 <    DLINK_FOREACH(ptr, target_p->localClient->confs.head)
2694 <    {
2695 <      conf = ptr->data;
2693 >    struct ConfItem *conf = cnode->data;
2694  
2695 <      if (conf->type == CLIENT_TYPE || conf->type == SERVER_TYPE ||
2696 <          conf->type == OPER_TYPE)
2697 <      {
2698 <        aconf = (struct AccessItem *) map_to_conf(conf);
2699 <        if (aconf->class_ptr != NULL)
2700 <          return aconf->class_ptr->name;
2703 <      }
2704 <    }
2695 >    assert((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) ||
2696 >          (conf->type == OPER_TYPE));
2697 >
2698 >    aconf = map_to_conf(conf);
2699 >    if (aconf->class_ptr != NULL)
2700 >      return aconf->class_ptr->name;
2701    }
2702  
2703    return "default";
# Line 2717 | Line 2713 | get_client_class(struct Client *target_p
2713   int
2714   get_client_ping(struct Client *target_p, int *pingwarn)
2715   {
2716 <  int ping;
2717 <  struct ConfItem *conf;
2722 <  dlink_node *nlink;
2716 >  int ping = 0;
2717 >  dlink_node *cnode = NULL;
2718  
2719 <  if (target_p->localClient->confs.head != NULL)
2720 <    DLINK_FOREACH(nlink, target_p->localClient->confs.head)
2721 <    {
2727 <      conf = nlink->data;
2719 >  if ((cnode = target_p->localClient->confs.head))
2720 >  {
2721 >    struct ConfItem *conf = cnode->data;
2722  
2723 <      if ((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) ||
2724 <          (conf->type == OPER_TYPE))
2725 <      {
2726 <        ping = get_conf_ping(conf, pingwarn);
2727 <        if (ping > 0)
2728 <          return ping;
2729 <      }
2736 <    }
2723 >    assert((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) ||
2724 >          (conf->type == OPER_TYPE));
2725 >
2726 >    ping = get_conf_ping(conf, pingwarn);
2727 >    if (ping > 0)
2728 >      return ping;
2729 >  }
2730  
2731    *pingwarn = 0;
2732    return DEFAULT_PINGFREQUENCY;
# Line 2813 | Line 2806 | unsigned int
2806   get_sendq(struct Client *client_p)
2807   {
2808    unsigned int sendq = DEFAULT_SENDQ;
2809 <  dlink_node *ptr;
2817 <  struct ConfItem *conf;
2809 >  dlink_node *cnode;
2810    struct ConfItem *class_conf;
2811    struct ClassItem *aclass;
2812    struct AccessItem *aconf;
2813  
2814 <  if (client_p && !IsMe(client_p) && (client_p->localClient->confs.head))
2814 >  assert(IsMe(client_p));
2815 >
2816 >  if ((cnode = client_p->localClient->confs.head))
2817    {
2818 <    DLINK_FOREACH(ptr, client_p->localClient->confs.head)
2819 <    {
2820 <      conf = ptr->data;
2821 <      if ((conf->type == SERVER_TYPE) || (conf->type == OPER_TYPE)
2822 <          || (conf->type == CLIENT_TYPE))
2823 <      {
2824 <        aconf = (struct AccessItem *)map_to_conf(conf);
2825 <        if ((class_conf = aconf->class_ptr) == NULL)
2826 <          continue;
2827 <        aclass = (struct ClassItem *)map_to_conf(class_conf);
2828 <        sendq = aclass->max_sendq;
2829 <        return sendq;
2830 <      }
2837 <    }
2818 >    struct ConfItem *conf = cnode->data;
2819 >
2820 >    assert((conf->type == CLIENT_TYPE) || (conf->type == SERVER_TYPE) ||
2821 >          (conf->type == OPER_TYPE));
2822 >
2823 >    aconf = map_to_conf(conf);
2824 >
2825 >    if ((class_conf = aconf->class_ptr) == NULL)
2826 >      return DEFAULT_SENDQ; /* TBV: shouldn't be possible at all */
2827 >
2828 >    aclass = map_to_conf(class_conf);
2829 >    sendq = aclass->max_sendq;
2830 >    return sendq;
2831    }
2832 +
2833    /* XXX return a default?
2834     * if here, then there wasn't an attached conf with a sendq
2835     * that is very bad -Dianora

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines