summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-07 21:44:44 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-07 21:44:44 +0000
commit5e98adde5d5da261882dfe76b18cc2af2217a875 (patch)
tree54d8cdef6b8adfd4e528c0fdb392a5738b382390 /src
parentc67ab9aa97de6072e40efa528e80ffb2a7e45280 (diff)
Feature request from djGrr, allow changing of server to server ping frequency
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7686 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp6
-rw-r--r--src/modules/m_spanningtree/utils.h4
5 files changed, 13 insertions, 5 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 2b159fa4e..3d472bf7a 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -485,7 +485,7 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime)
if (serv->AnsweredLastPing())
{
sock->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" PING "+serv->GetName());
- serv->SetNextPingTime(curtime + 60);
+ serv->SetNextPingTime(curtime + Utils->PingFreq);
serv->LastPing = curtime;
timeval t;
gettimeofday(&t, NULL);
@@ -503,7 +503,7 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime)
return;
}
}
- else if ((Utils->PingWarnTime) && (!serv->Warned) && (curtime >= serv->NextPingTime() - (60 - Utils->PingWarnTime)) && (!serv->AnsweredLastPing()))
+ else if ((Utils->PingWarnTime) && (!serv->Warned) && (curtime >= serv->NextPingTime() - (Utils->PingFreq - 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);
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index b5cac1802..d13075f0f 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -67,7 +67,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str
{
VersionString.clear();
UserCount = OperCount = 0;
- this->SetNextPingTime(time(NULL) + 60);
+ this->SetNextPingTime(time(NULL) + Utils->PingFreq);
this->SetPingFlag();
rtt = LastPing = 0;
/* find the 'route' for this server (e.g. the one directly connected
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index fc6853ba8..88c7666bf 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -1111,7 +1111,7 @@ bool TreeSocket::ProcessLine(std::string &line)
* When there is activity on the socket, reset the ping counter so
* that we're not wasting bandwidth pinging an active server.
*/
- route_back_again->SetNextPingTime(time(NULL) + 60);
+ route_back_again->SetNextPingTime(time(NULL) + Utils->PingFreq);
route_back_again->SetPingFlag();
}
else
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index bfd46ef03..1c54c5a68 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -498,8 +498,12 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
ChallengeResponse = !Conf->ReadFlag("options", "disablehmac", 0);
quiet_bursts = Conf->ReadFlag("options", "quietbursts", 0);
PingWarnTime = Conf->ReadInteger("options", "pingwarning", 0, true);
+ PingFreq = Conf->ReadInteger("options", "serverpingfreq", 0, true);
- if (PingWarnTime < 0 || PingWarnTime > 59)
+ if (PingFreq == 0)
+ PingFreq = 60;
+
+ if (PingWarnTime < 0 || PingWarnTime > PingFreq - 1)
PingWarnTime = 0;
LinkBlocks.clear();
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index cb783a81a..3a36a2e20 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -123,6 +123,10 @@ class SpanningTreeUtilities
*/
bool ChallengeResponse;
+ /** Ping frequency of server to server links
+ */
+ int PingFreq;
+
/** Initialise utility class
*/
SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningTree* Creator);