From b14ebbccf08ec34a73e1ba271e67da80d9fe805c Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 15 Jul 2013 13:40:22 +0200 Subject: m_spanningtree Move all server-to-server command handlers into handler classes These commands are not registered in or called by the core. When looking for the handler of a command a new command table is searched first which contains all server-to-server commands. If a handler cannot be found in there, the core command table is consulted. --- src/modules/m_spanningtree/pong.cpp | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'src/modules/m_spanningtree/pong.cpp') 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 ¶ms) +CmdResult CommandPong::Handle(User* user, std::vector& 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; } -- cgit v1.3.1-10-gc9f91