1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 18:23:14 +02:00

Move CONNECTTIMEOUT to set::handshake-timeout and clarify the setting

at https://www.unrealircd.org/docs/Set_block#set::handshake-timeout
Requested by marco500 in #5011.
This commit is contained in:
Bram Matthys
2017-10-07 08:45:48 +02:00
parent d6acbf63b0
commit 7a33a2c019
4 changed files with 20 additions and 11 deletions
-8
View File
@@ -384,14 +384,6 @@
*/
#define WRITEWAITDELAY 15 /* Recommended value: 15 */
/*
* Number of seconds to wait for a connect(2) call to complete.
* NOTE: this must be at *LEAST* 10. When a client connects, it has
* CONNECTTIMEOUT - 10 seconds for its host to respond to an ident lookup
* query and for a DNS answer to be retrieved.
*/
#define CONNECTTIMEOUT 30 /* Recommended value: 60 */
/*
* Max time from the nickname change that still causes KILL
* automaticly to switch for the current nick of that user. (seconds)
+1
View File
@@ -143,6 +143,7 @@ struct zConfiguration {
int nicklen;
int hide_list;
int max_unknown_connections_per_ip;
long handshake_timeout;
};
#ifndef DYNCONF_C
+2 -2
View File
@@ -542,7 +542,7 @@ EVENT(check_unknowns)
list_for_each_entry_safe(cptr, cptr2, &unknown_list, lclient_node)
{
if (cptr->local->firsttime && ((TStime() - cptr->local->firsttime) > CONNECTTIMEOUT))
if (cptr->local->firsttime && ((TStime() - cptr->local->firsttime) > iConf.handshake_timeout))
{
(void)exit_client(cptr, cptr, &me, "Registration Timeout");
continue;
@@ -558,7 +558,7 @@ int check_ping(aClient *cptr)
char scratch[64];
int ping = 0;
ping = cptr->local->class ? cptr->local->class->pingfreq : CONNECTTIMEOUT;
ping = cptr->local->class ? cptr->local->class->pingfreq : iConf.handshake_timeout;
Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %d", cptr->name,
cptr->status, ping,
TStime() - cptr->local->lasttime));
+17 -1
View File
@@ -1502,6 +1502,7 @@ void config_setdefaultsettings(aConfiguration *i)
DISABLE_IPV6 = 1;
i->network.x_prefix_quit = strdup("Quit");
i->max_unknown_connections_per_ip = 3;
i->handshake_timeout = 30;
/* SSL/TLS options */
i->ssl_options = MyMallocEx(sizeof(SSLOptions));
@@ -7865,6 +7866,10 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce)
{
tempiConf.max_unknown_connections_per_ip = atoi(cep->ce_vardata);
}
else if (!strcmp(cep->ce_varname, "handshake-timeout"))
{
tempiConf.handshake_timeout = config_checkval(cep->ce_vardata, CFG_TIME);
}
else
{
int value;
@@ -8774,13 +8779,24 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce)
int v;
CheckNull(cep);
v = atoi(cep->ce_vardata);
if (v <= 1)
if (v < 1)
{
config_error("%s:%i: set::max-unknown-connections-per-ip: value should be at least 1.",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
errors++;
}
}
else if (!strcmp(cep->ce_varname, "handshake-timeout")) {
int v;
CheckNull(cep);
v = config_checkval(cep->ce_vardata, CFG_TIME);
if (v < 5)
{
config_error("%s:%i: set::handshake-timeout: value should be at least 5 seconds.",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
errors++;
}
}
else
{
int used = 0;