1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "commands/cmd_whois.h"
16 #include "commands/cmd_stats.h"
20 #include "transport.h"
21 #include "socketengine.h"
23 #include "m_spanningtree/main.h"
24 #include "m_spanningtree/utils.h"
25 #include "m_spanningtree/treeserver.h"
26 #include "m_spanningtree/treesocket.h"
28 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
30 bool TreeSocket::LocalPong(const std::string &prefix, std::deque<std::string> ¶ms)
32 if (params.size() < 1)
35 if (params.size() == 1)
37 TreeServer* ServerSource = Utils->FindServer(prefix);
40 ServerSource->SetPingFlag();
42 gettimeofday(&t, NULL);
43 long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
44 ServerSource->rtt = ts - ServerSource->LastPingMsec;
49 std::string forwardto = params[1];
50 if (forwardto == Instance->Config->GetSID() || forwardto == Instance->Config->ServerName)
53 * this is a PONG for us
54 * if the prefix is a user, check theyre local, and if they are,
55 * dump the PONG reply back to their fd. If its a server, do nowt.
56 * Services might want to send these s->s, but we dont need to yet.
58 User* u = this->Instance->FindNick(prefix);
61 u->WriteServ("PONG %s %s",params[0].c_str(),params[1].c_str());
64 TreeServer *ServerSource = Utils->FindServer(params[0]);
69 gettimeofday(&t, NULL);
70 long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
71 ServerSource->rtt = ts - ServerSource->LastPingMsec;
72 ServerSource->SetPingFlag();
77 // not for us, pass it on :)
78 Utils->DoOneToOne(prefix,"PONG",params,forwardto);