From 7ef2f87e39bd22c7914caf7f2afbb1a3bf8fbd43 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 14 Apr 2018 16:53:03 +0100 Subject: Remove the default value in ConfigTag::get{Duration,Float,Int}. --- src/modules/extra/m_mysql.cpp | 2 +- src/modules/extra/m_ssl_mbedtls.cpp | 4 ++-- src/modules/extra/m_ssl_openssl.cpp | 4 ++-- src/modules/m_connflood.cpp | 8 ++++---- src/modules/m_permchannels.cpp | 2 +- src/modules/m_spanningtree/utils.cpp | 11 ++++------- 6 files changed, 14 insertions(+), 17 deletions(-) (limited to 'src/modules') diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index a177951ce..6c65cd87e 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -272,7 +272,7 @@ class SQLConnection : public SQL::Provider std::string user = config->getString("user"); std::string pass = config->getString("pass"); std::string dbname = config->getString("name"); - int port = config->getInt("port"); + int port = config->getInt("port", 3306); bool rv = mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, NULL, 0); if (!rv) return rv; diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index 8c15342f2..391d4d79b 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -413,8 +413,8 @@ namespace mbedTLS , mindh(tag->getInt("mindhbits", 2048)) , hashstr(tag->getString("hash", "sha256")) , castr(tag->getString("cafile")) - , minver(tag->getInt("minver")) - , maxver(tag->getInt("maxver")) + , minver(tag->getInt("minver", 0)) + , maxver(tag->getInt("maxver", 0)) , outrecsize(tag->getInt("outrecsize", 2048, 512, 16384)) , requestclientcert(tag->getBool("requestclientcert", true)) { diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 2129e5da7..828fcc26a 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -334,8 +334,8 @@ namespace OpenSSL */ void SetContextOptions(const std::string& ctxname, ConfigTag* tag, Context& context) { - long setoptions = tag->getInt(ctxname + "setoptions"); - long clearoptions = tag->getInt(ctxname + "clearoptions"); + long setoptions = tag->getInt(ctxname + "setoptions", 0); + long clearoptions = tag->getInt(ctxname + "clearoptions", 0); #ifdef SSL_OP_NO_COMPRESSION if (!tag->getBool("compression", false)) // Disable compression by default setoptions |= SSL_OP_NO_COMPRESSION; diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 1d27e3990..29d4d9d3a 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -46,13 +46,13 @@ public: /* read configuration variables */ ConfigTag* tag = ServerInstance->Config->ConfValue("connflood"); /* throttle configuration */ - seconds = tag->getDuration("period", tag->getInt("seconds")); - maxconns = tag->getInt("maxconns"); - timeout = tag->getDuration("timeout"); + seconds = tag->getDuration("period", tag->getInt("seconds", 30)); + maxconns = tag->getInt("maxconns", 3); + timeout = tag->getDuration("timeout", 30); quitmsg = tag->getString("quitmsg"); /* seconds to wait when the server just booted */ - boot_wait = tag->getInt("bootwait"); + boot_wait = tag->getInt("bootwait", 10); first = ServerInstance->Time(); } diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 7e28c5fc6..95f01839e 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -206,7 +206,7 @@ public: time_t TS = tag->getInt("ts", ServerInstance->Time(), 1); c = new Channel(channel, TS); - unsigned int topicset = tag->getInt("topicts"); + unsigned int topicset = tag->getInt("topicts", 0); std::string topic = tag->getString("topic"); if ((topicset != 0) || (!topic.empty())) diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 0a96ecfcd..d6f74cc69 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -229,13 +229,10 @@ void SpanningTreeUtilities::ReadConfiguration() AnnounceTSChange = options->getBool("announcets"); AllowOptCommon = options->getBool("allowmismatch"); quiet_bursts = ServerInstance->Config->ConfValue("performance")->getBool("quietbursts"); - PingWarnTime = options->getDuration("pingwarning"); - PingFreq = options->getDuration("serverpingfreq"); + PingWarnTime = options->getDuration("pingwarning", 15); + PingFreq = options->getDuration("serverpingfreq", 60, 1); - if (PingFreq == 0) - PingFreq = 60; - - if (PingWarnTime > PingFreq - 1) + if (PingWarnTime >= PingFreq) PingWarnTime = 0; AutoconnectBlocks.clear(); @@ -253,7 +250,7 @@ void SpanningTreeUtilities::ReadConfiguration() L->AllowMasks.push_back(s); L->IPAddr = tag->getString("ipaddr"); - L->Port = tag->getInt("port"); + L->Port = tag->getInt("port", 0); L->SendPass = tag->getString("sendpass", tag->getString("password")); L->RecvPass = tag->getString("recvpass", tag->getString("password")); L->Fingerprint = tag->getString("fingerprint"); -- cgit v1.2.3