diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.h | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.h | 4 |
4 files changed, 18 insertions, 0 deletions
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; |