1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 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();
38 gettimeofday(&t, NULL);
39 long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
40 ServerSource->rtt = ts - ServerSource->LastPingMsec;
45 std::string forwardto = params[1];
46 if (forwardto == ServerInstance->Config->GetSID() || forwardto == ServerInstance->Config->ServerName)
49 * this is a PONG for us
50 * if the prefix is a user, check theyre local, and if they are,
51 * dump the PONG reply back to their fd. If its a server, do nowt.
52 * Services might want to send these s->s, but we dont need to yet.
54 User* u = ServerInstance->FindNick(prefix);
57 u->WriteServ("PONG %s %s",params[0].c_str(),params[1].c_str());
60 TreeServer *ServerSource = Utils->FindServer(params[0]);
65 gettimeofday(&t, NULL);
66 long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
67 ServerSource->rtt = ts - ServerSource->LastPingMsec;
68 ServerSource->SetPingFlag();
73 // not for us, pass it on :)
74 Utils->DoOneToOne(prefix,"PONG",params,forwardto);