1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
17 #include "socketengine.h"
21 #include "treeserver.h"
22 #include "treesocket.h"
24 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
26 bool TreeSocket::LocalPong(const std::string &prefix, parameterlist ¶ms)
28 if (params.size() < 1)
31 if (params.size() == 1)
33 TreeServer* ServerSource = Utils->FindServer(prefix);
36 ServerSource->SetPingFlag();
37 long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
38 ServerSource->rtt = ts - ServerSource->LastPingMsec;
43 std::string forwardto = params[1];
44 if (forwardto == ServerInstance->Config->GetSID() || forwardto == ServerInstance->Config->ServerName)
47 * this is a PONG for us
48 * if the prefix is a user, check theyre local, and if they are,
49 * dump the PONG reply back to their fd. If its a server, do nowt.
50 * Services might want to send these s->s, but we dont need to yet.
52 User* u = ServerInstance->FindNick(prefix);
55 u->WriteServ("PONG %s %s",params[0].c_str(),params[1].c_str());
58 TreeServer *ServerSource = Utils->FindServer(params[0]);
62 long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000);
63 ServerSource->rtt = ts - ServerSource->LastPingMsec;
64 ServerSource->SetPingFlag();
69 // not for us, pass it on :)
70 Utils->DoOneToOne(prefix,"PONG",params,forwardto);