Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Jan 15, 2025
1 parent 37dd366 commit 500acf7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
17 changes: 11 additions & 6 deletions src/Mumble.proto
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,15 @@ message UserStats {
optional uint32 resync = 4;
}

message RollingStats {
// Rolling packet statistics time window as defined on the server.
optional uint32 time_window = 1;
// Rolling packet statistics for packets received from the client.
optional Stats from_client = 2;
// Rolling packet statistics for packets sent by the server.
optional Stats from_server = 3;
}

// User whose stats these are.
optional uint32 session = 1;
// True if the message contains only mutable stats (packets, ping).
Expand Down Expand Up @@ -554,12 +563,8 @@ message UserStats {
optional bool strong_certificate = 18 [default = false];
optional bool opus = 19 [default = false];

// Rolling packet statistics time window as defined on the server.
optional uint32 rolling_time_window = 20;
// Rolling packet statistics for packets received from the client.
optional Stats rolling_from_client = 21;
// Rolling packet statistics for packets sent by the server.
optional Stats rolling_from_server = 22;
// Rolling packet statistics
optional RollingStats rolling_stats = 20;
}

// Used by the client to request binary data from the server. By default large
Expand Down
13 changes: 7 additions & 6 deletions src/mumble/UserInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ void UserInformation::update(const MumbleProto::UserStats &msg) {
qlTCPVar->setText(QString::number(msg.tcp_ping_var() > 0.0f ? sqrtf(msg.tcp_ping_var()) : 0.0f, 'f', 2));
qlUDPVar->setText(QString::number(msg.udp_ping_var() > 0.0f ? sqrtf(msg.udp_ping_var()) : 0.0f, 'f', 2));

bool hasTotalStats = msg.has_from_client() && msg.has_from_server();
bool hasRollingStats =
msg.has_rolling_time_window() && msg.has_rolling_from_client() && msg.has_rolling_from_server();
bool hasTotalStats = msg.has_from_client() && msg.has_from_server();
bool hasRollingStats = msg.has_rolling_stats();

qgbUDP->setVisible(hasTotalStats || hasRollingStats);

Expand Down Expand Up @@ -194,13 +193,15 @@ void UserInformation::update(const MumbleProto::UserStats &msg) {
}

if (hasRollingStats) {
const MumbleProto::UserStats_Stats &from = msg.rolling_from_client();
const MumbleProto::UserStats_RollingStats &rolling = msg.rolling_stats();

const MumbleProto::UserStats_Stats &from = rolling.from_client();
qlFromGoodRolling->setText(QString::number(from.good()));
qlFromLateRolling->setText(QString::number(from.late()));
qlFromLostRolling->setText(QString::number(from.lost()));
qlFromResyncRolling->setText(QString::number(from.resync()));

const MumbleProto::UserStats_Stats &to = msg.rolling_from_server();
const MumbleProto::UserStats_Stats &to = rolling.from_server();
qlToGoodRolling->setText(QString::number(to.good()));
qlToLateRolling->setText(QString::number(to.late()));
qlToLostRolling->setText(QString::number(to.lost()));
Expand All @@ -218,7 +219,7 @@ void UserInformation::update(const MumbleProto::UserStats &msg) {
qlToLostPercentRolling->setText(
QString::number(allToPackets > 0 ? to.lost() * 100.0 / allToPackets : 0., 'f', 1));

uint32_t rollingSeconds = msg.rolling_time_window();
uint32_t rollingSeconds = rolling.time_window();
QString rollingText = tr("Last %1 %2:");
if (rollingSeconds < 120) {
qliRolling->setText(rollingText.arg(QString::number(rollingSeconds)).arg(tr("seconds")));
Expand Down
8 changes: 5 additions & 3 deletions src/murmur/Messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,9 @@ void Server::msgUserStats(ServerUser *uSource, MumbleProto::UserStats &msg) {
bool outsideInitialWindow =
static_cast< unsigned int >(bwr.onlineSeconds()) > pDstServerUser->csCrypt->m_rollingWindow.count();

mpusss = msg.mutable_rolling_from_client();
MumbleProto::UserStats_RollingStats *mpussrs = msg.mutable_rolling_stats();

mpusss = mpussrs->mutable_from_client();
if (outsideInitialWindow) {
mpusss->set_good(pDstServerUser->csCrypt->m_statsLocalRolling.good);
mpusss->set_late(pDstServerUser->csCrypt->m_statsLocalRolling.late);
Expand All @@ -2299,7 +2301,7 @@ void Server::msgUserStats(ServerUser *uSource, MumbleProto::UserStats &msg) {
mpusss->CopyFrom(*msg.mutable_from_client());
}

mpusss = msg.mutable_rolling_from_server();
mpusss = mpussrs->mutable_from_server();
if (outsideInitialWindow) {
mpusss->set_good(pDstServerUser->csCrypt->m_statsRemoteRolling.good);
mpusss->set_late(pDstServerUser->csCrypt->m_statsRemoteRolling.late);
Expand All @@ -2309,7 +2311,7 @@ void Server::msgUserStats(ServerUser *uSource, MumbleProto::UserStats &msg) {
mpusss->CopyFrom(*msg.mutable_from_server());
}

msg.set_rolling_time_window(pDstServerUser->csCrypt->m_rollingWindow.count());
mpussrs->set_time_window(pDstServerUser->csCrypt->m_rollingWindow.count());
}

msg.set_udp_packets(pDstServerUser->uiUDPPackets);
Expand Down

0 comments on commit 500acf7

Please sign in to comment.