Show throttle info in /stats t.

from ircd-ratbox (androsyn)
This commit is contained in:
Jilles Tjoelker 2008-12-16 21:02:04 +01:00
parent 422bb0b553
commit ae09cb7dbe
4 changed files with 13 additions and 2 deletions

View 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

View 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 */

View 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());

View 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++;