mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +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.
|
||||
// If so, migrate the BandwidthRecorder into the NetworkPeer class
|
||||
using BandwidthRecorderPtr = QSharedPointer < BandwidthRecorder > ;
|
||||
using BandwidthRecorderPtr = QSharedPointer<BandwidthRecorder>;
|
||||
static QHash<QUuid, BandwidthRecorderPtr> PEER_BANDWIDTH;
|
||||
|
||||
BandwidthRecorder & getBandwidthRecorder(const QUuid & uuid) {
|
||||
BandwidthRecorder& getBandwidthRecorder(const QUuid & uuid) {
|
||||
if (!PEER_BANDWIDTH.count(uuid)) {
|
||||
PEER_BANDWIDTH.insert(uuid, BandwidthRecorderPtr(new BandwidthRecorder()));
|
||||
}
|
||||
return *PEER_BANDWIDTH[uuid].data();
|
||||
}
|
||||
|
||||
|
||||
void NetworkPeer::recordBytesSent(int count) {
|
||||
auto & bw = getBandwidthRecorder(_uuid);
|
||||
auto& bw = getBandwidthRecorder(_uuid);
|
||||
bw.updateOutboundData(0, count);
|
||||
}
|
||||
|
||||
void NetworkPeer::recordBytesReceived(int count) {
|
||||
auto & bw = getBandwidthRecorder(_uuid);
|
||||
auto& bw = getBandwidthRecorder(_uuid);
|
||||
bw.updateInboundData(0, count);
|
||||
}
|
||||
|
||||
float NetworkPeer::getOutboundBandwidth() {
|
||||
auto & bw = getBandwidthRecorder(_uuid);
|
||||
auto& bw = getBandwidthRecorder(_uuid);
|
||||
return bw.getAverageOutputKilobitsPerSecond(0);
|
||||
}
|
||||
|
||||
float NetworkPeer::getInboundBandwidth() {
|
||||
auto & bw = getBandwidthRecorder(_uuid);
|
||||
auto& bw = getBandwidthRecorder(_uuid);
|
||||
return bw.getAverageInputKilobitsPerSecond(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue