diff --git a/src/Mumble.proto b/src/Mumble.proto index 1b26ac342a..ca1e4cbba5 100644 --- a/src/Mumble.proto +++ b/src/Mumble.proto @@ -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). @@ -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 diff --git a/src/mumble/UserInformation.cpp b/src/mumble/UserInformation.cpp index e09fb127c1..ff8573c0d5 100644 --- a/src/mumble/UserInformation.cpp +++ b/src/mumble/UserInformation.cpp @@ -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); @@ -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())); @@ -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"))); diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp index 593ac0cb3e..a24da2c26a 100644 --- a/src/murmur/Messages.cpp +++ b/src/murmur/Messages.cpp @@ -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); @@ -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); @@ -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);