mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:40:20 +02:00
type & squish
This commit is contained in:
parent
bf607e4c9c
commit
599fe09e75
1 changed files with 6 additions and 7 deletions
|
@ -102,33 +102,32 @@ QDebug operator<<(QDebug debug, const NetworkPeer &peer) {
|
||||||
|
|
||||||
// FIXME this is a temporary implementation to determine if this is the right approach.
|
// FIXME this is a temporary implementation to determine if this is the right approach.
|
||||||
// If so, migrate the BandwidthRecorder into the NetworkPeer class
|
// If so, migrate the BandwidthRecorder into the NetworkPeer class
|
||||||
using BandwidthRecorderPtr = QSharedPointer < BandwidthRecorder > ;
|
using BandwidthRecorderPtr = QSharedPointer<BandwidthRecorder>;
|
||||||
static QHash<QUuid, BandwidthRecorderPtr> PEER_BANDWIDTH;
|
static QHash<QUuid, BandwidthRecorderPtr> PEER_BANDWIDTH;
|
||||||
|
|
||||||
BandwidthRecorder & getBandwidthRecorder(const QUuid & uuid) {
|
BandwidthRecorder& getBandwidthRecorder(const QUuid & uuid) {
|
||||||
if (!PEER_BANDWIDTH.count(uuid)) {
|
if (!PEER_BANDWIDTH.count(uuid)) {
|
||||||
PEER_BANDWIDTH.insert(uuid, BandwidthRecorderPtr(new BandwidthRecorder()));
|
PEER_BANDWIDTH.insert(uuid, BandwidthRecorderPtr(new BandwidthRecorder()));
|
||||||
}
|
}
|
||||||
return *PEER_BANDWIDTH[uuid].data();
|
return *PEER_BANDWIDTH[uuid].data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NetworkPeer::recordBytesSent(int count) {
|
void NetworkPeer::recordBytesSent(int count) {
|
||||||
auto & bw = getBandwidthRecorder(_uuid);
|
auto& bw = getBandwidthRecorder(_uuid);
|
||||||
bw.updateOutboundData(0, count);
|
bw.updateOutboundData(0, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkPeer::recordBytesReceived(int count) {
|
void NetworkPeer::recordBytesReceived(int count) {
|
||||||
auto & bw = getBandwidthRecorder(_uuid);
|
auto& bw = getBandwidthRecorder(_uuid);
|
||||||
bw.updateInboundData(0, count);
|
bw.updateInboundData(0, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
float NetworkPeer::getOutboundBandwidth() {
|
float NetworkPeer::getOutboundBandwidth() {
|
||||||
auto & bw = getBandwidthRecorder(_uuid);
|
auto& bw = getBandwidthRecorder(_uuid);
|
||||||
return bw.getAverageOutputKilobitsPerSecond(0);
|
return bw.getAverageOutputKilobitsPerSecond(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float NetworkPeer::getInboundBandwidth() {
|
float NetworkPeer::getInboundBandwidth() {
|
||||||
auto & bw = getBandwidthRecorder(_uuid);
|
auto& bw = getBandwidthRecorder(_uuid);
|
||||||
return bw.getAverageInputKilobitsPerSecond(0);
|
return bw.getAverageInputKilobitsPerSecond(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue