]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Convert a bunch of time-related config options to getDuration.
authorPeter Powell <petpow@saberuk.com>
Sun, 13 Aug 2017 15:26:48 +0000 (16:26 +0100)
committerPeter Powell <petpow@saberuk.com>
Sun, 3 Sep 2017 19:20:30 +0000 (20:20 +0100)
16 files changed:
docs/conf/inspircd.conf.example
docs/conf/links.conf.example
docs/conf/modules.conf.example
src/configreader.cpp
src/listensocket.cpp
src/modules/extra/m_ldap.cpp
src/modules/m_blockamsg.cpp
src/modules/m_callerid.cpp
src/modules/m_conn_join.cpp
src/modules/m_connflood.cpp
src/modules/m_flashpolicyd.cpp
src/modules/m_httpd.cpp
src/modules/m_ident.cpp
src/modules/m_repeat.cpp
src/modules/m_securelist.cpp
src/modules/m_spanningtree/utils.cpp

index a25f4aee13c559a48787a8c434fdeb3e51accd95..90f260ad379c43b05d78dfd6c51e44b04aed08e5 100644 (file)
 
       # 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.
          # 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"
          # 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
      #
      # 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
          # 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.
index f3e07f7ed4e55021f87bf67d03273a76456ba8dd..f3c0807f81a29412da7f7f64768e74b1fde929e5 100644 (file)
@@ -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"
 # 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">
 
 
index 93e26059c73d812e4a64fb5f2675c4850f954381..e66ad91be085ab73644c8701caeb8fe1aaa6efda 100644 (file)
 # 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.                       #
 # 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
 #<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
 # 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">
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 # 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">
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 # 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 /
index 220026155aefb8a9c80300a52f38092bb6afd0b8..f29356c0cd17a1c094f156c96d8bbfbc9d23fee5 100644 (file)
@@ -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))
                        {
index d09f5e62436ea60ca1a70c33c2ea699b13c255f8..dc588386de7893e2b27b78ddd1f6341f9695931e 100644 (file)
@@ -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
index fc1bee939c9369a07b6741d9ed712b0000665cd2..08d81e9602df9eecd1a159d3b00350a83d53249f 100644 (file)
@@ -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();
        }
index 266497b9092b38b5f3f0c1491d82b8ad4e851703..7d97069f540f9ad2b07d7980a97fa3158c492d03 100644 (file)
@@ -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")
index e11b326de73a7941977946c086b83b92b6c7581f..a00da6a6f8b4b1e3098494e0afe21e9b20e783c0 100644 (file)
@@ -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
index bd8d89dc9b54365e895da7f7ad626b0e7778e8e9..7a06aedd3911c5cb7eeb967e8485aada4e306a0c 100644 (file)
@@ -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())
                {
index 2ab906e27c42d1e2f34b583dfaf0898e8b4f3314..1d27e3990d1581f967486cecef6ef068967c164e 100644 (file)
@@ -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 */
index 38b7be73fa65e75fbe4e46638ada706dec40497f..b44b72dbfebfe56c8bb418c465a241d30bbdb0b0 100644 (file)
@@ -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())
index 35ae9abe5cecd8b7ba010e86a5e53e9e27919917..961a70473f7383cfd152dead0711d45e61370078 100644 (file)
@@ -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
index 0e5aa43aea55b74d5c61a94ff4e3ba06b0e5cd8f..806c70ad2410b86c4ece7c09850f50abab959b3d 100644 (file)
@@ -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);
        }
 
index 9715fcf6f8b05fa0c7df533a547d5b1f9f9e68ad..6c34648e0cadd210157ed785b04add2d3262c1a7 100644 (file)
@@ -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)
index b925c3f3733cea83d744a25677c253ffc2794855..e36b9e403b8f487f47ebac69aff60a0cd901b027 100644 (file)
@@ -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);
        }
 
 
index c1c32e80a39037ea2aab83d21feb2bdbb2e54cfa..79dc24e6a0ccb7bab55347285f948219cbbaa5e0 100644 (file)
@@ -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;