]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Show throttle info in /stats t.
authorJilles Tjoelker <redacted>
Tue, 16 Dec 2008 20:02:04 +0000 (21:02 +0100)
committerJilles Tjoelker <redacted>
Tue, 16 Dec 2008 20:02:04 +0000 (21:02 +0100)
from ircd-ratbox (androsyn)

include/reject.h
include/s_stats.h
modules/m_stats.c
src/reject.c

index 0f559bc144c82c6a1546724a0596d8372fafa812..c6e27eedf063f8283bc76ba21fddfdc729fd7141 100644 (file)
@@ -38,6 +38,7 @@ int remove_reject_mask(const char *mask1, const char *mask2);
 unsigned long delay_exit_length(void);
 
 int throttle_add(struct sockaddr *addr);
+unsigned long throttle_size(void);
 
 
 #endif
index ef9a8c30ad5c33bbf83478921623f7e0b78dd62a..f4f45c0921656ce015a1102f199bc8ab47f4cf4c 100644 (file)
@@ -63,6 +63,7 @@ struct ServerStatistics
        unsigned int is_asuc;   /* successful auth requests */
        unsigned int is_abad;   /* bad auth requests */
        unsigned int is_rej;    /* rejected from cache */
+       unsigned int is_thr;    /* number of throttled connections */
        unsigned int is_ssuc;   /* successful sasl authentications */
        unsigned int is_sbad;   /* failed sasl authentications */
        unsigned int is_tgch;   /* messages blocked due to target change */
index b779b96db404e5f2828b82c8598786684a1bdeca..3b08b5d387a8fcfa3bca49c9d6d8553b4bcf7e2d 100644 (file)
@@ -876,6 +876,8 @@ stats_tstats (struct Client *source_p)
        sendto_one_numeric(source_p, RPL_STATSDEBUG,
                        "T :rejected %u delaying %lu", 
                        sp.is_rej, delay_exit_length());
+       sendto_one_numeric(source_p, RPL_STATSDEBUG,
+                          "T :throttled refused %u throttle list size %lu", sp.is_thr, throttle_size());
        sendto_one_numeric(source_p, RPL_STATSDEBUG,
                        "T :nicks being delayed %lu",
                        get_nd_count());
index b5035c6567f0854897a1625d6b201f16b2742359..f6d4b3d200f0bebd7bcce7e677bf074fd0637095 100644 (file)
@@ -122,6 +122,11 @@ init_reject(void)
        rb_event_add("throttle_expires", throttle_expires, NULL, 10);
 }
 
+unsigned long
+throttle_size(void)
+{
+       return rb_dlink_list_length(&throttle_list);
+}
 
 void
 add_reject(struct Client *client_p, const char *mask1, const char *mask2)
@@ -269,8 +274,10 @@ throttle_add(struct sockaddr *addr)
                t = pnode->data;
 
                if(t->count > ConfigFileEntry.throttle_count)
-                       return 1;                       
-
+               {
+                       ServerStats.is_thr++;
+                       return 1;
+               }
                /* Stop penalizing them after they've been throttled */
                t->last = rb_current_time();
                t->count++;