summaryrefslogtreecommitdiff
path: root/src/ActivePeerConnectionCommand.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ActivePeerConnectionCommand.cc')
-rw-r--r--src/ActivePeerConnectionCommand.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ActivePeerConnectionCommand.cc b/src/ActivePeerConnectionCommand.cc
index 7f5709d8..24ec1efd 100644
--- a/src/ActivePeerConnectionCommand.cc
+++ b/src/ActivePeerConnectionCommand.cc
@@ -48,6 +48,7 @@
#include "BtAnnounce.h"
#include "RequestGroup.h"
#include "DownloadContext.h"
+#include "bittorrent_helper.h"
namespace aria2 {
@@ -81,8 +82,14 @@ bool ActivePeerConnectionCommand::execute() {
const unsigned int maxDownloadLimit =
_requestGroup->getMaxDownloadSpeedLimit();
const unsigned int maxUploadLimit = _requestGroup->getMaxUploadSpeedLimit();
- unsigned int thresholdSpeed =
- _requestGroup->getOption()->getAsInt(PREF_BT_REQUEST_PEER_SPEED_LIMIT);
+ unsigned int thresholdSpeed;
+ if(_requestGroup->getDownloadContext()->
+ getAttribute(bittorrent::BITTORRENT).containsKey(bittorrent::METADATA)) {
+ thresholdSpeed =
+ _requestGroup->getOption()->getAsInt(PREF_BT_REQUEST_PEER_SPEED_LIMIT);
+ } else {
+ thresholdSpeed = 0;
+ }
if(maxDownloadLimit > 0) {
thresholdSpeed = std::min(maxDownloadLimit, thresholdSpeed);
}