diff --git a/include/reject.h b/include/reject.h index 0f559bc..c6e27ee 100644 --- a/include/reject.h +++ b/include/reject.h @@ -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 diff --git a/include/s_stats.h b/include/s_stats.h index ef9a8c3..f4f45c0 100644 --- a/include/s_stats.h +++ b/include/s_stats.h @@ -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 */ diff --git a/modules/m_stats.c b/modules/m_stats.c index b779b96..3b08b5d 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -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()); diff --git a/src/reject.c b/src/reject.c index b5035c6..f6d4b3d 100644 --- a/src/reject.c +++ b/src/reject.c @@ -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++;