diff options
author | Peter Powell <petpow@saberuk.com> | 2017-08-13 16:26:48 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2017-09-03 20:20:30 +0100 |
commit | e7c829af5941c6a8a303ca75ed9ac47570347e41 (patch) | |
tree | a40aa5b57346eb0b83e6f6b2cef1df36732800e5 | |
parent | 74dd288542e28f3604306cc69468f88b14c1b3c5 (diff) |
Convert a bunch of time-related config options to getDuration.
-rw-r--r-- | docs/conf/inspircd.conf.example | 22 | ||||
-rw-r--r-- | docs/conf/links.conf.example | 6 | ||||
-rw-r--r-- | docs/conf/modules.conf.example | 22 | ||||
-rw-r--r-- | src/configreader.cpp | 4 | ||||
-rw-r--r-- | src/listensocket.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_ldap.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_blockamsg.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_callerid.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_conn_join.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_connflood.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_flashpolicyd.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_httpd.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_ident.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_repeat.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_securelist.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 4 |
16 files changed, 42 insertions, 42 deletions
diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index a25f4aee1..90f260ad3 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -163,7 +163,7 @@ # defer: When this is non-zero, connections will not be handed over to # the daemon from the operating system before data is ready. - # In Linux, the value indicates the number of seconds we'll wait for a + # In Linux, the value indicates the time period we'll wait for a # connection to come up with data. Don't set it too low! # In BSD the value is ignored; only zero and non-zero is possible. # Windows ignores this parameter completely. @@ -261,8 +261,8 @@ # be in at one time. maxchans="20" - # timeout: How long (in seconds) the server will wait before - # disconnecting a user if they do not do anything on connect. + # timeout: How long the server will wait before disconnecting + # a user if they do not do anything on connect. # (Note, this is a client-side thing, if the client does not # send /nick, /user or /pass) timeout="10" @@ -338,14 +338,14 @@ # be in at one time. maxchans="20" - # timeout: How long (in seconds) the server will wait before - # disconnecting a user if they do not do anything on connect. + # timeout: How long the server will wait before disconnecting + # a user if they do not do anything on connect. # (Note, this is a client-side thing, if the client does not # send /nick, /user or /pass) timeout="10" - # pingfreq: How often (in seconds) the server tries to ping connecting clients. - pingfreq="120" + # pingfreq: How often the server tries to ping connecting clients. + pingfreq="2m" # hardsendq: maximum amount of data allowed in a client's send queue # before they are dropped. Keep this value higher than the length of @@ -468,7 +468,7 @@ # # server="127.0.0.1" - # timeout: seconds to wait to try to resolve DNS/hostname. + # timeout: time to wait to try to resolve DNS/hostname. timeout="5"> # An example of using an IPv6 nameserver @@ -586,13 +586,13 @@ # in the topic. If set to no, it will only show the nick of the topic setter. hostintopic="yes" - # pingwarning: If a server does not respond to a ping within x seconds, + # pingwarning: If a server does not respond to a ping within this period, # it will send a notice to opers with snomask +l informing that the server # is about to ping timeout. pingwarning="15" - # serverpingfreq: How often pings are sent between servers (in seconds). - serverpingfreq="60" + # serverpingfreq: How often pings are sent between servers. + serverpingfreq="1m" # defaultmodes: What modes are set on a empty channel when a user # joins it and it is unregistered. diff --git a/docs/conf/links.conf.example b/docs/conf/links.conf.example index f3e07f7ed..f3c0807f8 100644 --- a/docs/conf/links.conf.example +++ b/docs/conf/links.conf.example @@ -34,7 +34,7 @@ # timeout: If defined, this option defines how long the server # will wait to consider the connect attempt failed and try the # failover (see above). - timeout="300" + timeout="5m" # ssl: If defined, this states the SSL profile that will be used when # making an outbound connection to the server. Options are the name of an @@ -77,7 +77,7 @@ ipaddr="penguin.example.org" port="7000" allowmask="203.0.113.0/24" - timeout="300" + timeout="5m" ssl="gnutls" bind="1.2.3.4" statshidden="no" @@ -104,7 +104,7 @@ # space separated servers to autoconnect; they will be tried in a round # robin fashion until one succeeds. Period defines the time for restarting # a single loop. -<autoconnect period="120" +<autoconnect period="2m" server="hub.us.example.org hub.eu.example.org leaf.eu.example.org"> diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 93e26059c..e66ad91be 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -231,8 +231,8 @@ # If you have the blockamsg module loaded, you can configure it with # # the <blockamsg> tag: # # # -# delay - How many seconds between two messages to force # -# them to be recognised as unrelated. # +# delay - How much time between two messages to force them # +# to be recognised as unrelated. # # action - Any of 'notice', 'noticeopers', 'silent', 'kill' # # or 'killopers'. Define how to take action when # # a user uses /amsg or /ame. # @@ -281,13 +281,13 @@ # tracknick - Preserve /accept entries when a user changes nick? # # If no (the default), the user is removed from # # everyone's accept list if he changes nickname. # -# cooldown - Amount of time (in seconds) that must pass since # -# the last notification sent to a user before he can # -# be sent another. Default is 60 (1 minute). # +# cooldown - Amount of time that must pass since the last # +# notification sent to a user before he can be sent # +# another. Default is 1 minute. # #<callerid maxaccepts="16" # operoverride="no" # tracknick="no" -# cooldown="60"> +# cooldown="1m"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # CAP module: Provides the CAP negotiation mechanism required by the @@ -588,7 +588,7 @@ #<module name="connflood"> # #-#-#-#-#-#-#-#-#-#-#- CONNTHROTTLE CONFIGURATION -#-#-#-#-#-#-#-#-#-# -# seconds, maxconns - Amount of connections per <seconds>. +# period, maxconns - Amount of connections per <period>. # # timeout - Time to wait after the throttle was activated # before deactivating it. Be aware that the time @@ -892,7 +892,7 @@ # httpd_* modules to provide pages to display. # # You can adjust the timeout for HTTP connections below. All HTTP -# connections will be closed after (roughly) this many seconds. +# connections will be closed after (roughly) this time period. #<httpd timeout="20"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -1570,11 +1570,11 @@ # maxbacklog - Maximum size that can be specified for backlog. 0 disables multiline matching. # maxdistance - Max percentage of difference between two lines we'll allow to match. Set to 0 to disable edit-distance matching. # maxlines - Max lines of backlog to match against. -# maxsecs - Maximum value of seconds a user can set. 0 to allow any. +# maxtime - Maximum period of time a user can set. 0 to allow any. # size - Maximum number of characters to check for, can be used to truncate messages # before they are checked, resulting in less CPU usage. Increasing this beyond 512 # doesn't have any effect, as the maximum length of a message on IRC cannot exceed that. -#<repeat maxbacklog="20" maxlines="20" maxdistance="50" maxsecs="0" size="512"> +#<repeat maxbacklog="20" maxlines="20" maxdistance="50" maxtime="0" size="512"> #<module name="repeat"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -1697,7 +1697,7 @@ # Define the following variable to change how long a user must wait # # before issuing a LIST. If not defined, defaults to 60 seconds. # # # -#<securelist waittime="60"> # +#<securelist waittime="1m"> # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Servprotect module: Provides support for Austhex style +k / diff --git a/src/configreader.cpp b/src/configreader.cpp index 220026155..f29356c0c 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -310,8 +310,8 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) me->name = name; - me->registration_timeout = tag->getInt("timeout", me->registration_timeout); - me->pingtime = tag->getInt("pingfreq", me->pingtime); + me->registration_timeout = tag->getDuration("timeout", me->registration_timeout); + me->pingtime = tag->getDuration("pingfreq", me->pingtime); std::string sendq; if (tag->readString("sendq", sendq)) { diff --git a/src/listensocket.cpp b/src/listensocket.cpp index d09f5e624..dc588386d 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -74,7 +74,7 @@ ListenSocket::ListenSocket(ConfigTag* tag, const irc::sockets::sockaddrs& bind_t rv = SocketEngine::Listen(this->fd, ServerInstance->Config->MaxConn); // Default defer to on for TLS listeners because in TLS the client always speaks first - int timeout = tag->getInt("defer", (tag->getString("ssl").empty() ? 0 : 3)); + int timeout = tag->getDuration("defer", (tag->getString("ssl").empty() ? 0 : 3)); if (timeout && !rv) { #if defined TCP_DEFER_ACCEPT diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp index fc1bee939..08d81e960 100644 --- a/src/modules/extra/m_ldap.cpp +++ b/src/modules/extra/m_ldap.cpp @@ -263,7 +263,7 @@ class LDAPService : public LDAPProvider, public SocketThread searchscope = LDAP_SCOPE_ONELEVEL; else searchscope = LDAP_SCOPE_SUBTREE; - timeout = config->getInt("timeout", 5); + timeout = config->getDuration("timeout", 5); Connect(); } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 266497b90..7d97069f5 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -66,7 +66,7 @@ class ModuleBlockAmsg : public Module void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("blockamsg"); - ForgetDelay = tag->getInt("delay", -1); + ForgetDelay = tag->getDuration("delay", -1); std::string act = tag->getString("action"); if (act == "notice") diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index e11b326de..a00da6a6f 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -425,7 +425,7 @@ public: cmd.maxaccepts = tag->getInt("maxaccepts", 16); operoverride = tag->getBool("operoverride"); tracknick = tag->getBool("tracknick"); - notify_cooldown = tag->getInt("cooldown", 60); + notify_cooldown = tag->getDuration("cooldown", 60); } void Prioritize() CXX11_OVERRIDE diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index bd8d89dc9..7a06aedd3 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -75,7 +75,7 @@ class ModuleConnJoin : public Module { ConfigTag* tag = ServerInstance->Config->ConfValue("autojoin"); defchans = tag->getString("channel"); - defdelay = tag->getInt("delay", 0, 0, 60); + defdelay = tag->getDuration("delay", 0, 0, 60); } void Prioritize() CXX11_OVERRIDE @@ -95,7 +95,7 @@ class ModuleConnJoin : public Module return; std::string chanlist = localuser->GetClass()->config->getString("autojoin"); - unsigned int chandelay = localuser->GetClass()->config->getInt("autojoindelay", 0, 0, 60); + unsigned int chandelay = localuser->GetClass()->config->getDuration("autojoindelay", 0, 0, 60); if (chanlist.empty()) { diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 2ab906e27..1d27e3990 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -46,9 +46,9 @@ public: /* read configuration variables */ ConfigTag* tag = ServerInstance->Config->ConfValue("connflood"); /* throttle configuration */ - seconds = tag->getInt("seconds"); + seconds = tag->getDuration("period", tag->getInt("seconds")); maxconns = tag->getInt("maxconns"); - timeout = tag->getInt("timeout"); + timeout = tag->getDuration("timeout"); quitmsg = tag->getString("quitmsg"); /* seconds to wait when the server just booted */ diff --git a/src/modules/m_flashpolicyd.cpp b/src/modules/m_flashpolicyd.cpp index 38b7be73f..b44b72dbf 100644 --- a/src/modules/m_flashpolicyd.cpp +++ b/src/modules/m_flashpolicyd.cpp @@ -97,7 +97,7 @@ class ModuleFlashPD : public Module void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("flashpolicyd"); - timeout = tag->getInt("timeout", 5, 1); + timeout = tag->getDuration("timeout", 5, 1); std::string file = tag->getString("file"); if (!file.empty()) diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 35ae9abe5..961a70473 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -401,7 +401,7 @@ class ModuleHttpServer : public Module void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("httpd"); - timeoutsec = tag->getInt("timeout", 10, 1); + timeoutsec = tag->getDuration("timeout", 10, 1); } ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 0e5aa43ae..806c70ad2 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -271,7 +271,7 @@ class ModuleIdent : public Module void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("ident"); - RequestTimeout = tag->getInt("timeout", 5, 1); + RequestTimeout = tag->getDuration("timeout", 5, 1); NoLookupPrefix = tag->getBool("nolookupprefix", false); } diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index 9715fcf6f..6c34648e0 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -233,7 +233,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> > ConfigTag* conf = ServerInstance->Config->ConfValue("repeat"); ms.MaxLines = conf->getInt("maxlines", 20); ms.MaxBacklog = conf->getInt("maxbacklog", 20); - ms.MaxSecs = conf->getInt("maxsecs", 0); + ms.MaxSecs = conf->getDuration("maxtime", conf->getInt("maxsecs", 0)); ms.MaxDiff = conf->getInt("maxdistance", 50); if (ms.MaxDiff > 100) diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index b925c3f37..e36b9e403 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -40,7 +40,7 @@ class ModuleSecureList : public Module for (ConfigIter i = tags.first; i != tags.second; ++i) allowlist.push_back(i->second->getString("exception")); - WaitTime = ServerInstance->Config->ConfValue("securelist")->getInt("waittime", 60); + WaitTime = ServerInstance->Config->ConfValue("securelist")->getDuration("waittime", 60); } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index c1c32e80a..79dc24e6a 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -229,8 +229,8 @@ void SpanningTreeUtilities::ReadConfiguration() AnnounceTSChange = options->getBool("announcets"); AllowOptCommon = options->getBool("allowmismatch"); quiet_bursts = ServerInstance->Config->ConfValue("performance")->getBool("quietbursts"); - PingWarnTime = options->getInt("pingwarning"); - PingFreq = options->getInt("serverpingfreq"); + PingWarnTime = options->getDuration("pingwarning"); + PingFreq = options->getDuration("serverpingfreq"); if (PingFreq == 0) PingFreq = 60; |