diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-05 19:22:10 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-05 19:22:10 +0000 |
commit | 728a907e887406df109f37e68cafbb3abd2a02e4 (patch) | |
tree | d9b339a9c72d83fbca25396234c315c05ae5d6cc /src | |
parent | 56b89baf233a7ef85e33b297437ba61e627e423c (diff) |
Change latency figures in /map to milliseconds, much more useful for lag measurement than seconds
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7667 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.h | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 9a678dc5b..2b159fa4e 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -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 diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index 514d6bc07..d8d3b70e8 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -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 */ diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 077350d20..fc6853ba8 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -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 |