summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/inspircd.conf.example30
-rw-r--r--src/modules/m_spanningtree/main.cpp7
-rw-r--r--src/modules/m_spanningtree/treeserver.h2
-rw-r--r--src/modules/m_spanningtree/utils.cpp5
-rw-r--r--src/modules/m_spanningtree/utils.h4
5 files changed, 37 insertions, 11 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index 5a0df63a4..3b09090ad 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -267,13 +267,13 @@
<connect allow="*"
timeout="60"
- flood="20"
- threshold="1"
- pingfreq="120"
- sendq="262144"
- recvq="8192"
- localmax="3"
- globalmax="3">
+ flood="20"
+ threshold="1"
+ pingfreq="120"
+ sendq="262144"
+ recvq="8192"
+ localmax="3"
+ globalmax="3">
<connect deny="69.254.*">
<connect deny="3ffe::0/32">
@@ -868,6 +868,13 @@
# such as BOPM which rely on them to scan users when #
# a split heals in certain configurations. #
# #
+# pingwarning - This should be set to a number between 1 and 59 if #
+# defined, and if it is defined will cause the server#
+# to send out a warning via snomask +l if a server #
+# does not answer to PING after this many seconds. #
+# This can be useful for finding servers which are #
+# at risk of pinging out due to network issues. #
+# #
<options prefixquit="Quit: "
loglevel="default"
@@ -876,7 +883,7 @@
noservices="no"
qaprefixes="no"
deprotectself="no"
- deprotectothers="no"
+ deprotectothers="no"
somaxconn="128"
softlimit="12800"
userstats="Pu"
@@ -893,10 +900,11 @@
cyclehosts="yes"
ircumsgprefix="no"
announcets="yes"
- disablehmac="no"
+ disablehmac="no"
hostintopic="yes"
- hidemodes="eI"
- quietbursts="yes"
+ hidemodes="eI"
+ quietbursts="yes"
+ pingwarning="15"
allowhalfop="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#- TIME SYNC OPTIONS -#-#-#-#-#-#-#-#-#-#-#-#
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 09574f15f..4dc6eedc0 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -463,6 +463,7 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime)
sock->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" PING "+serv->GetName());
serv->SetNextPingTime(curtime + 60);
serv->LastPing = curtime;
+ serv->Warned = false;
}
else
{
@@ -476,6 +477,12 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime)
return;
}
}
+ else if ((Utils->PingWarnTime) && (!serv->Warned) && (curtime >= serv->NextPingTime() - (60 - Utils->PingWarnTime)) && (!serv->AnsweredLastPing()))
+ {
+ /* The server hasnt responded, send a warning to opers */
+ ServerInstance->SNO->WriteToSnoMask('l',"Server \002%s\002 has not responded to PING for %d seconds, high latency.", serv->GetName().c_str(), Utils->PingWarnTime);
+ serv->Warned = true;
+ }
}
}
}
diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h
index c65fc0dee..514d6bc07 100644
--- a/src/modules/m_spanningtree/treeserver.h
+++ b/src/modules/m_spanningtree/treeserver.h
@@ -46,6 +46,8 @@ class TreeServer : public classbase
public:
+ bool Warned; /* True if we've warned opers about high latency on this server */
+
/** We don't use this constructor. Its a dummy, and won't cause any insertion
* of the TreeServer into the hash_map. See below for the two we DO use.
*/
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index a27dd5f65..680fe5eb1 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -505,6 +505,11 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
MasterTime = Conf->ReadFlag("timesync", "master", 0);
ChallengeResponse = !Conf->ReadFlag("options", "disablehmac", 0);
quiet_bursts = Conf->ReadFlag("options", "quietbursts", 0);
+ PingWarnTime = Conf->ReadInteger("options", "pingwarning", 0, true);
+
+ if (PingWarnTime < 0 || PingWarnTime > 59)
+ PingWarnTime = 0;
+
LinkBlocks.clear();
ValidIPs.clear();
for (int j =0; j < Conf->Enumerate("link"); j++)
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index f9f61acaf..1c94e264f 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -72,6 +72,10 @@ class SpanningTreeUtilities
/** Socket bindings for listening sockets
*/
std::vector<TreeSocket*> Bindings;
+ /* Number of seconds that a server can go without ping
+ * before opers are warned of high latency.
+ */
+ int PingWarnTime;
/** This variable represents the root of the server tree
*/
TreeServer *TreeRoot;