mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-15 09:04:10 +00:00
fix(dashboard): Network connections are one entry per player or per connection, not per address
A player on the servers' machine (or behind the same address as other players) was merged with the servers' own links and everyone else there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -110,10 +110,14 @@ namespace NetworkView {
|
||||
const auto name = label ? label(server) : key;
|
||||
const auto seconds = std::max<int64_t>(server.connectionsSeconds, 1);
|
||||
for (const auto& c : server.connections) {
|
||||
auto& group = groups[c.address];
|
||||
group.address = c.address;
|
||||
group.seconds = std::max(group.seconds, seconds);
|
||||
const std::string kind = c.peer != TrafficStats::Peer::CLIENTS ? "server" : c.http ? "web" : "game";
|
||||
// One entry per player (their account), else per connection: an address alone is not enough, since the
|
||||
// servers' own links and players on the same machine or network share it
|
||||
const std::string groupKey = kind == "game" && c.accountId ? "account:" + std::to_string(c.accountId)
|
||||
: kind + "|" + c.address + (c.http ? std::string() : ":" + std::to_string(c.port));
|
||||
auto& group = groups[groupKey];
|
||||
if (group.address.empty()) group.address = c.address;
|
||||
group.seconds = std::max(group.seconds, seconds);
|
||||
if (rank(kind) > rank(group.kind)) group.kind = kind;
|
||||
if (c.accountId && !group.accountId) {
|
||||
group.accountId = c.accountId;
|
||||
|
||||
Reference in New Issue
Block a user