]> jfr.im git - solanum.git/blobdiff - ircd/class.c
ircd: rework sendq limits a bit.
[solanum.git] / ircd / class.c
index a7eb528ac112bb31abb08afd0968358e707d149a..25a7f53f9f1874df3416ea439c60e99e39ceda6f 100644 (file)
@@ -55,6 +55,7 @@ make_class(void)
        PingFreq(tmp) = DEFAULT_PINGFREQUENCY;
        MaxUsers(tmp) = 1;
        MaxSendq(tmp) = DEFAULT_SENDQ;
+       MaxSendqHard(tmp) = DEFAULT_SENDQ * 4;
 
        tmp->ip_limits = rb_new_patricia(PATRICIA_BITS);
        return tmp;
@@ -198,6 +199,7 @@ add_class(struct Class *classptr)
                MaxIdent(tmpptr) = MaxIdent(classptr);
                PingFreq(tmpptr) = PingFreq(classptr);
                MaxSendq(tmpptr) = MaxSendq(classptr);
+               MaxSendqHard(tmpptr) = MaxSendq(classptr) * 4;
                ConFreq(tmpptr) = ConFreq(classptr);
                CidrIpv4Bitlen(tmpptr) = CidrIpv4Bitlen(classptr);
                CidrIpv6Bitlen(tmpptr) = CidrIpv6Bitlen(classptr);
@@ -342,3 +344,33 @@ get_sendq(struct Client *client_p)
 
        return DEFAULT_SENDQ;
 }
+
+/*
+ * get_sendq_hard
+ *
+ * inputs      - pointer to client
+ * output      - hard sendq limit for this client as found from its class
+ * side effects        - NONE
+ */
+long
+get_sendq_hard(struct Client *client_p)
+{
+       if(client_p == NULL || IsMe(client_p))
+               return DEFAULT_SENDQ;
+
+       if(IsServer(client_p))
+       {
+               struct server_conf *server_p;
+               server_p = client_p->localClient->att_sconf;
+               return MaxSendqHard(server_p->class);
+       }
+       else
+       {
+               struct ConfItem *aconf = client_p->localClient->att_conf;
+
+               if(aconf != NULL && aconf->status & CONF_CLIENT)
+                       return ConfMaxSendqHard(aconf);
+       }
+
+       return DEFAULT_SENDQ;
+}