diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-07-15 13:40:22 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-08-18 15:11:02 +0200 |
commit | b14ebbccf08ec34a73e1ba271e67da80d9fe805c (patch) | |
tree | 012640699b3960940af3756ef1e881747b0aa8d1 /src/modules/m_spanningtree/pong.cpp | |
parent | 153179b574dccd6df9c5c5f3e68f3c1725e26843 (diff) |
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.
Diffstat (limited to 'src/modules/m_spanningtree/pong.cpp')
-rw-r--r-- | src/modules/m_spanningtree/pong.cpp | 33 |
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 ¶ms) +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; } |