mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
Merge pull request #1086 from majestrate/lokinetmon-update-2020-02-07
update lokinet monitor to work with iwp
This commit is contained in:
commit
4371ea469d
@ -54,6 +54,9 @@ class Monitor:
|
||||
y += 1
|
||||
self.win.move(y, 1)
|
||||
y += 1
|
||||
self.win.addstr("[tx:\t{}]\t[rx:\t{}]".format(self.speedOf(path['txRateCurrent']), self.speedOf(path['rxRateCurrent'])))
|
||||
self.win.move(y, 1)
|
||||
y += 1
|
||||
self.win.addstr("me -> ")
|
||||
for hop in path["hops"]:
|
||||
self.win.addstr(" {} ->".format(hop["router"][:4]))
|
||||
@ -94,12 +97,12 @@ class Monitor:
|
||||
self.win.addstr("paths: {}".format(len(paths)))
|
||||
for path in paths:
|
||||
y = self._render_path(y, path, "inbound")
|
||||
for session in status["remoteSessions"]:
|
||||
for session in (status["remoteSessions"] or []):
|
||||
for path in session["paths"]:
|
||||
y = self._render_path(
|
||||
y, path, "[active] {}".format(session["currentConvoTag"])
|
||||
)
|
||||
for session in status["snodeSessions"]:
|
||||
for session in (status["snodeSessions"] or []):
|
||||
for path in session["paths"]:
|
||||
y = self._render_path(y, path, "[snode]")
|
||||
return y
|
||||
@ -194,15 +197,17 @@ class Monitor:
|
||||
for s in sessions:
|
||||
y += 1
|
||||
self.win.move(y, 1)
|
||||
self.txrate += s["tx"]
|
||||
self.rxrate += s["rx"]
|
||||
self.txrate += s["txRateCurrent"]
|
||||
self.rxrate += s["rxRateCurrent"]
|
||||
self.win.addstr(
|
||||
"{}\t[{}\ttx]\t[{}\trx]".format(
|
||||
s["remoteAddr"], self.speedOf(s["tx"]), self.speedOf(s["rx"])
|
||||
s["remoteAddr"], self.speedOf(s["txRateCurrent"]), self.speedOf(s["rxRateCurrent"])
|
||||
)
|
||||
)
|
||||
if s["sendBacklog"] > 0:
|
||||
self.win.addstr("[backlog {}]".format(s["sendBacklog"]))
|
||||
if (s['txMsgs'] or 0) > 1:
|
||||
self.win.addstr(" [out window:\t{}]".format(s['txMsgQueueSize']))
|
||||
if (s['rxMsgs'] or 0) > 1:
|
||||
self.win.addstr(" [in window:\t{}]".format(s['rxMsgQueueSize']))
|
||||
return y
|
||||
|
||||
def display_dht(self, y, data):
|
||||
|
@ -103,6 +103,8 @@ namespace llarp
|
||||
bool
|
||||
Path::IsReady() const
|
||||
{
|
||||
if(Expired(llarp::time_now_ms()))
|
||||
return false;
|
||||
return intro.latency > 0 && _status == ePathEstablished;
|
||||
}
|
||||
|
||||
@ -307,6 +309,8 @@ namespace llarp
|
||||
{"expiresSoon", ExpiresSoon(now)},
|
||||
{"expiresAt", ExpireTime()},
|
||||
{"ready", IsReady()},
|
||||
{"txRateCurrent", m_LastTXRate},
|
||||
{"rxRateCurrent", m_LastRXRate},
|
||||
{"hasExit", SupportsAnyRoles(ePathRoleExit)}};
|
||||
|
||||
std::vector< util::StatusObject > hopsObj;
|
||||
@ -359,6 +363,12 @@ namespace llarp
|
||||
if(Expired(now))
|
||||
return;
|
||||
|
||||
m_LastRXRate = m_RXRate;
|
||||
m_LastTXRate = m_TXRate;
|
||||
|
||||
m_RXRate = 0;
|
||||
m_TXRate = 0;
|
||||
|
||||
m_UpstreamReplayFilter.Decay(now);
|
||||
m_DownstreamReplayFilter.Decay(now);
|
||||
|
||||
@ -420,7 +430,11 @@ namespace llarp
|
||||
{
|
||||
for(const auto& msg : msgs)
|
||||
{
|
||||
if(!r->SendToOrQueue(Upstream(), &msg))
|
||||
if(r->SendToOrQueue(Upstream(), &msg))
|
||||
{
|
||||
m_TXRate += msg.X.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug("failed to send upstream to ", Upstream());
|
||||
}
|
||||
@ -531,6 +545,7 @@ namespace llarp
|
||||
for(const auto& msg : msgs)
|
||||
{
|
||||
const llarp_buffer_t buf(msg.X);
|
||||
m_RXRate += buf.sz;
|
||||
if(!HandleRoutingMessage(buf, r))
|
||||
{
|
||||
LogWarn("failed to handle downstream message");
|
||||
|
@ -405,6 +405,10 @@ namespace llarp
|
||||
PathRole _role;
|
||||
util::DecayingHashSet< TunnelNonce > m_UpstreamReplayFilter;
|
||||
util::DecayingHashSet< TunnelNonce > m_DownstreamReplayFilter;
|
||||
uint64_t m_LastRXRate = 0;
|
||||
uint64_t m_RXRate = 0;
|
||||
uint64_t m_LastTXRate = 0;
|
||||
uint64_t m_TXRate = 0;
|
||||
};
|
||||
} // namespace path
|
||||
} // namespace llarp
|
||||
|
Loading…
Reference in New Issue
Block a user