0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 06:51:08 +01:00

Revert "ircd: rework sendq limits a bit."

This reverts commit 9a5958119c.
This commit is contained in:
William Pitcock 2016-01-20 22:27:33 -05:00
parent 999fab778c
commit 912cae0c9c
4 changed files with 5 additions and 53 deletions

View file

@ -40,7 +40,6 @@ struct Class
int max_global; int max_global;
int max_ident; int max_ident;
int max_sendq; int max_sendq;
int max_sendq_hard;
int con_freq; int con_freq;
int ping_freq; int ping_freq;
int total; int total;
@ -62,7 +61,6 @@ extern struct Class *default_class;
#define MaxUsers(x) ((x)->max_total) #define MaxUsers(x) ((x)->max_total)
#define PingFreq(x) ((x)->ping_freq) #define PingFreq(x) ((x)->ping_freq)
#define MaxSendq(x) ((x)->max_sendq) #define MaxSendq(x) ((x)->max_sendq)
#define MaxSendqHard(x) ((x)->max_sendq_hard)
#define CurrUsers(x) ((x)->total) #define CurrUsers(x) ((x)->total)
#define IpLimits(x) ((x)->ip_limits) #define IpLimits(x) ((x)->ip_limits)
#define CidrIpv4Bitlen(x) ((x)->cidr_ipv4_bitlen) #define CidrIpv4Bitlen(x) ((x)->cidr_ipv4_bitlen)
@ -83,14 +81,12 @@ extern struct Class *default_class;
#define ConfCidrAmount(x) (ClassPtr(x)->cidr_amount) #define ConfCidrAmount(x) (ClassPtr(x)->cidr_amount)
#define ConfCidrIpv4Bitlen(x) (ClassPtr(x)->cidr_ipv4_bitlen) #define ConfCidrIpv4Bitlen(x) (ClassPtr(x)->cidr_ipv4_bitlen)
#define ConfCidrIpv6Bitlen(x) (ClassPtr(x)->cidr_ipv6_bitlen) #define ConfCidrIpv6Bitlen(x) (ClassPtr(x)->cidr_ipv6_bitlen)
#define ConfMaxSendqHard(x) (ClassPtr(x)->max_sendq_hard)
void add_class(struct Class *); void add_class(struct Class *);
struct Class *make_class(void); struct Class *make_class(void);
extern long get_sendq(struct Client *); extern long get_sendq(struct Client *);
extern long get_sendq_hard(struct Client *);
extern int get_con_freq(struct Class *); extern int get_con_freq(struct Class *);
extern struct Class *find_class(const char *); extern struct Class *find_class(const char *);
extern const char *get_client_class(struct Client *); extern const char *get_client_class(struct Client *);

View file

@ -55,7 +55,6 @@ make_class(void)
PingFreq(tmp) = DEFAULT_PINGFREQUENCY; PingFreq(tmp) = DEFAULT_PINGFREQUENCY;
MaxUsers(tmp) = 1; MaxUsers(tmp) = 1;
MaxSendq(tmp) = DEFAULT_SENDQ; MaxSendq(tmp) = DEFAULT_SENDQ;
MaxSendqHard(tmp) = DEFAULT_SENDQ * 4;
tmp->ip_limits = rb_new_patricia(PATRICIA_BITS); tmp->ip_limits = rb_new_patricia(PATRICIA_BITS);
return tmp; return tmp;
@ -199,7 +198,6 @@ add_class(struct Class *classptr)
MaxIdent(tmpptr) = MaxIdent(classptr); MaxIdent(tmpptr) = MaxIdent(classptr);
PingFreq(tmpptr) = PingFreq(classptr); PingFreq(tmpptr) = PingFreq(classptr);
MaxSendq(tmpptr) = MaxSendq(classptr); MaxSendq(tmpptr) = MaxSendq(classptr);
MaxSendqHard(tmpptr) = MaxSendq(classptr) * 4;
ConFreq(tmpptr) = ConFreq(classptr); ConFreq(tmpptr) = ConFreq(classptr);
CidrIpv4Bitlen(tmpptr) = CidrIpv4Bitlen(classptr); CidrIpv4Bitlen(tmpptr) = CidrIpv4Bitlen(classptr);
CidrIpv6Bitlen(tmpptr) = CidrIpv6Bitlen(classptr); CidrIpv6Bitlen(tmpptr) = CidrIpv6Bitlen(classptr);
@ -344,33 +342,3 @@ get_sendq(struct Client *client_p)
return DEFAULT_SENDQ; 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;
}

View file

@ -108,23 +108,11 @@ parse_client_queued(struct Client *client_p)
else else
allow_read = ConfigFileEntry.client_flood_burst_rate; allow_read = ConfigFileEntry.client_flood_burst_rate;
allow_read *= ConfigFileEntry.client_flood_message_time; allow_read *= ConfigFileEntry.client_flood_message_time;
/* allow opers 4 times the amount of messages as users. why 4? /* allow opers 4 times the amount of messages as users. why 4?
* why not. :) --fl_ * why not. :) --fl_
*/ */
if(IsOper(client_p) && ConfigFileEntry.no_oper_flood) if(IsOper(client_p) && ConfigFileEntry.no_oper_flood)
allow_read *= 4; allow_read *= 4;
else
{
/*
* If a client's sendq is greater than the soft limit, do not allow any
* more messages to be read. This allows us to safely handle commands like
* LIST without harming the server. --kaniini
*/
if (rb_linebuf_len(&client_p->localClient->buf_sendq) > (get_sendq(client_p)))
allow_read = 0;
}
/* /*
* Handle flood protection here - if we exceed our flood limit on * Handle flood protection here - if we exceed our flood limit on
* messages in this loop, we simply drop out of the loop prematurely. * messages in this loop, we simply drop out of the loop prematurely.

View file

@ -69,20 +69,20 @@ _send_linebuf(struct Client *to, buf_head_t *linebuf)
if(!MyConnect(to) || IsIOError(to)) if(!MyConnect(to) || IsIOError(to))
return 0; return 0;
if(rb_linebuf_len(&to->localClient->buf_sendq) > get_sendq_hard(to)) if(rb_linebuf_len(&to->localClient->buf_sendq) > get_sendq(to))
{ {
if(IsServer(to)) if(IsServer(to))
{ {
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Hard SendQ limit exceeded for %s: %u > %lu", "Max SendQ limit exceeded for %s: %u > %lu",
to->name, to->name,
rb_linebuf_len(&to->localClient->buf_sendq), rb_linebuf_len(&to->localClient->buf_sendq),
get_sendq_hard(to)); get_sendq(to));
ilog(L_SERVER, "Hard SendQ limit exceeded for %s: %u > %lu", ilog(L_SERVER, "Max SendQ limit exceeded for %s: %u > %lu",
log_client_name(to, SHOW_IP), log_client_name(to, SHOW_IP),
rb_linebuf_len(&to->localClient->buf_sendq), rb_linebuf_len(&to->localClient->buf_sendq),
get_sendq_hard(to)); get_sendq(to));
} }
dead_link(to, 1); dead_link(to, 1);