diff --git a/dDashboardServer/static/js/network-graph.js b/dDashboardServer/static/js/network-graph.js index 08fcf023f..649dce328 100644 --- a/dDashboardServer/static/js/network-graph.js +++ b/dDashboardServer/static/js/network-graph.js @@ -166,7 +166,9 @@ if (split) { var c = rates(split.clients); - if (any(c)) edge('clients', id, c.packets_in, c.bytes_in, c.packets_out, c.bytes_out, true); + // A player standing still sends nothing for a while: their connection is still drawn (idle) + var players = (s.type === 'AUTH' || s.type === 'WORLD') ? Math.max(0, num((s.link || {}).connections) - 1) : 0; + if (any(c) || players > 0) edge('clients', id, c.packets_in, c.bytes_in, c.packets_out, c.bytes_out, true); var o = rates(split.servers); // A world's "other servers" is its chat link; chat's are the worlds, drawn from their side if (s.type === 'WORLD' && any(o)) edge(id, hasChat ? 'chat' : 'master', o.packets_out, o.bytes_out, o.packets_in, o.bytes_in, hasChat, 'packets', hasChat ? '' : 'chat link, chat not reporting'); diff --git a/tests/dWebTests/network-graph.test.mjs b/tests/dWebTests/network-graph.test.mjs index 52e6598a4..e58727638 100644 --- a/tests/dWebTests/network-graph.test.mjs +++ b/tests/dWebTests/network-graph.test.mjs @@ -178,3 +178,10 @@ console.log('network-graph: all passed'); const starts = Object.keys(W.paths).filter(id => id.includes('master')).map(id => W.paths[id].fwd); same(new Set(starts.map(d => d.split(' ')[0])).size > 1 || starts.length < 2, true, 'links at master do not all meet at one point'); } + +// An idle player (no packets in the window) still has a link from Game clients to their world +{ + const idle = G.build({ servers: { w: { key: 'w', type: 'WORLD', zone: 1200, instance: 1, label: 'World 1200', link: { connections: 2 }, + split: { clients: {}, master: {}, servers: {} }, packets_in: 0, packets_out: 0, bytes_in: 0, bytes_out: 0 } } }, {}); + same(idle.edges.some(e => e.from === 'clients'), true, 'idle player keeps the Game clients link'); +}