Skip to content
This repository was archived by the owner on Jun 24, 2021. It is now read-only.

Add class::max_autoconn configuration #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ class "server" {
*/
connectfreq = 5 minutes;

/* max number: the amount of servers to autoconnect to. if the number
/* max_autoconn: the amount of servers to autoconnect to. if the number
* of servers in the class is or exceeds this, no more servers in the
* class are autoconnected. oper initiated connects are unaffected.
* this should usually be set to either 0 or 1. (autoconnecting from
* hubs to leaves may cause leaves to function as hubs by having
* multiple servers connected to them.)
*/
max_number = 1;
max_autoconn = 1;

/* sendq: servers need a higher sendq as they are sent more data */
sendq = 2 megabytes;
Expand Down
2 changes: 2 additions & 0 deletions include/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct Class
struct Class *next;
char *class_name;
int max_total;
int max_autoconn;
int max_local;
int max_global;
int max_ident;
Expand All @@ -57,6 +58,7 @@ extern struct Class *default_class;
#define MaxGlobal(x) ((x)->max_global)
#define MaxIdent(x) ((x)->max_ident)
#define MaxUsers(x) ((x)->max_total)
#define MaxAutoconn(x) ((x)->max_autoconn)
#define PingFreq(x) ((x)->ping_freq)
#define MaxSendq(x) ((x)->max_sendq)
#define CurrUsers(x) ((x)->total)
Expand Down
7 changes: 7 additions & 0 deletions ircd/newconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,12 @@ conf_set_class_max_number(void *data)
yy_class->max_total = *(unsigned int *) data;
}

static void
conf_set_class_max_autoconn(void *data)
{
yy_class->max_autoconn = *(unsigned int *) data;
}

static void
conf_set_class_sendq(void *data)
{
Expand Down Expand Up @@ -2689,6 +2695,7 @@ static struct ConfEntry conf_class_table[] =
{ "number_per_ident", CF_INT, conf_set_class_number_per_ident, 0, NULL },
{ "connectfreq", CF_TIME, conf_set_class_connectfreq, 0, NULL },
{ "max_number", CF_INT, conf_set_class_max_number, 0, NULL },
{ "max_autoconn", CF_INT, conf_set_class_max_autoconn, 0, NULL },
{ "sendq", CF_TIME, conf_set_class_sendq, 0, NULL },
{ "\0", 0, NULL, 0, NULL }
};
Expand Down
2 changes: 1 addition & 1 deletion ircd/s_serv.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ try_connections(void *unused)
*/
client_p = find_server(NULL, tmp_p->name);

if(!client_p && (CurrUsers(cltmp) < MaxUsers(cltmp)) && !connecting)
if(!client_p && (CurrUsers(cltmp) < MaxAutoconn(cltmp)) && !connecting)
{
server_p = tmp_p;

Expand Down