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/link.h"
27 #include "m_spanningtree/treesocket.h"
28 #include "m_spanningtree/resolvers.h"
29 #include "m_spanningtree/handshaketimer.h"
31 /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
33 bool TreeSocket::LocalPong(const std::string &prefix, std::deque<std::string> ¶ms)
35 if (params.size() < 1)
38 if (params.size() == 1)
40 TreeServer* ServerSource = Utils->FindServer(prefix);
43 ServerSource->SetPingFlag();
45 gettimeofday(&t, NULL);
46 long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
47 ServerSource->rtt = ts - ServerSource->LastPingMsec;
52 std::string forwardto = params[1];
53 if (forwardto == Instance->Config->GetSID() || forwardto == Instance->Config->ServerName)
56 * this is a PONG for us
57 * if the prefix is a user, check theyre local, and if they are,
58 * dump the PONG reply back to their fd. If its a server, do nowt.
59 * Services might want to send these s->s, but we dont need to yet.
61 User* u = this->Instance->FindNick(prefix);
64 u->WriteServ("PONG %s %s",params[0].c_str(),params[1].c_str());
67 TreeServer *ServerSource = Utils->FindServer(params[0]);
72 gettimeofday(&t, NULL);
73 long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
74 ServerSource->rtt = ts - ServerSource->LastPingMsec;
75 ServerSource->SetPingFlag();
80 // not for us, pass it on :)
81 Utils->DoOneToOne(prefix,"PONG",params,forwardto);