summaryrefslogtreecommitdiff
path: root/src/ActivePeerConnectionCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-10-26 00:16:20 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-10-26 00:16:20 +0900
commit21c3903af0f5ee17b16453f82c809e03afd151d8 (patch)
tree36452a4b6a7886149a01f63e333ad561c486256c /src/ActivePeerConnectionCommand.cc
parent0ecfa19925453e3e4bf8ca947dc72a597654e401 (diff)
Simplified TransferStat struct
Diffstat (limited to 'src/ActivePeerConnectionCommand.cc')
-rw-r--r--src/ActivePeerConnectionCommand.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ActivePeerConnectionCommand.cc b/src/ActivePeerConnectionCommand.cc
index 35be6bea..e9bf9e32 100644
--- a/src/ActivePeerConnectionCommand.cc
+++ b/src/ActivePeerConnectionCommand.cc
@@ -81,7 +81,7 @@ bool ActivePeerConnectionCommand::execute() {
}
if(checkPoint_.difference(global::wallclock()) >= interval_) {
checkPoint_ = global::wallclock();
- TransferStat tstat = requestGroup_->calculateStat();
+ NetStat& stat = requestGroup_->getDownloadContext()->getNetStat();
const int maxDownloadLimit = requestGroup_->getMaxDownloadSpeedLimit();
const int maxUploadLimit = requestGroup_->getMaxUploadSpeedLimit();
int thresholdSpeed;
@@ -97,10 +97,11 @@ bool ActivePeerConnectionCommand::execute() {
}
if(// for seeder state
(pieceStorage_->downloadFinished() && btRuntime_->lessThanMaxPeers() &&
- (maxUploadLimit == 0 || tstat.getUploadSpeed() < maxUploadLimit*0.8)) ||
+ (maxUploadLimit == 0 ||
+ stat.calculateUploadSpeed() < maxUploadLimit*0.8)) ||
// for leecher state
(!pieceStorage_->downloadFinished() &&
- (tstat.getDownloadSpeed() < thresholdSpeed ||
+ (stat.calculateDownloadSpeed() < thresholdSpeed ||
btRuntime_->lessThanMinPeers()))) {
int numConnection = 0;