mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-12 20:19:02 -04:00
Backport as fix, as old way was somewhat useless:
Change latency figures in /map to milliseconds, much more useful for lag measurement than seconds git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@7668 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
49e184edd2
commit
9c730fabe9
@ -174,7 +174,7 @@ std::string ModuleSpanningTree::TimeToStr(time_t secs)
|
||||
const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current)
|
||||
{
|
||||
time_t secs_up = ServerInstance->Time() - Current->age;
|
||||
return (" [Up: " + TimeToStr(secs_up) + " Lag: "+ConvToStr(Current->rtt)+"s]");
|
||||
return (" [Up: " + TimeToStr(secs_up) + " Lag: "+ConvToStr(Current->rtt)+"ms]");
|
||||
}
|
||||
|
||||
// WARNING: NOT THREAD SAFE - DONT GET ANY SMART IDEAS.
|
||||
@ -487,6 +487,10 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime)
|
||||
sock->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" PING "+serv->GetName());
|
||||
serv->SetNextPingTime(curtime + 60);
|
||||
serv->LastPing = curtime;
|
||||
timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
|
||||
serv->LastPingMsec = ts;
|
||||
serv->Warned = false;
|
||||
}
|
||||
else
|
||||
|
@ -109,9 +109,13 @@ class TreeServer : public classbase
|
||||
*/
|
||||
time_t LastPing;
|
||||
|
||||
/** Last ping time in microseconds, used to calculate round trip time
|
||||
*/
|
||||
unsigned long LastPingMsec;
|
||||
|
||||
/** Round trip time of last ping
|
||||
*/
|
||||
time_t rtt;
|
||||
unsigned long rtt;
|
||||
|
||||
/** True if this server is hidden
|
||||
*/
|
||||
|
@ -365,7 +365,10 @@ bool TreeSocket::LocalPong(const std::string &prefix, std::deque<std::string> &p
|
||||
if (ServerSource)
|
||||
{
|
||||
ServerSource->SetPingFlag();
|
||||
ServerSource->rtt = Instance->Time() - ServerSource->LastPing;
|
||||
timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
|
||||
ServerSource->rtt = ts - ServerSource->LastPingMsec;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user