summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/pong.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_spanningtree/pong.cpp')
-rw-r--r--src/modules/m_spanningtree/pong.cpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/modules/m_spanningtree/pong.cpp b/src/modules/m_spanningtree/pong.cpp
index 034f1f891..006d51a10 100644
--- a/src/modules/m_spanningtree/pong.cpp
+++ b/src/modules/m_spanningtree/pong.cpp
@@ -21,30 +21,25 @@
#include "utils.h"
#include "treeserver.h"
-#include "treesocket.h"
+#include "commands.h"
+#include "utils.h"
-bool TreeSocket::LocalPong(const std::string &prefix, parameterlist &params)
+CmdResult CommandPong::Handle(User* user, std::vector<std::string>& params)
{
- if (params.size() < 1)
- return true;
-
- const std::string& forwardto = params[0];
- if (forwardto == ServerInstance->Config->GetSID())
+ TreeServer* server = Utils->FindServer(user->server);
+ if (server->bursting)
{
- // PONG for us
- TreeServer* ServerSource = Utils->FindServer(prefix);
- if (ServerSource)
- {
- long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
- ServerSource->rtt = ts - ServerSource->LastPingMsec;
- ServerSource->SetPingFlag();
- }
+ ServerInstance->SNO->WriteGlobalSno('l', "Server \002%s\002 has not finished burst, forcing end of burst (send ENDBURST!)", server->GetName().c_str());
+ server->FinishBurst();
}
- else
+
+ if (params[0] == ServerInstance->Config->GetSID())
{
- // not for us, pass it on :)
- Utils->DoOneToOne(prefix,"PONG",params,forwardto);
+ // PONG for us
+ long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
+ server->rtt = ts - server->LastPingMsec;
+ server->SetPingFlag();
}
- return true;
+ return CMD_SUCCESS;
}