diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-02-18 17:11:44 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-02-18 17:11:44 +0000 |
| commit | 3c41ea24bf2f4fc53c26f226db7c31a5e9b44fef (patch) | |
| tree | 094d900495cb916bcfdeed25a96f7942ab2a8238 /src/ActivePeerConnectionCommand.cc | |
| parent | 20cd2e52468f96f5aa0558aa30306e6abc6fbfcd (diff) | |
2008-02-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Determin _threadtholdSpeed in each constructor for
ActivePeerConnectionCommand and PeerReceiveHandshakeCommand.
* src/ActivePeerConnectionCommand.{h, cc}
* src/PeerReceiveHandshakeCommand.{h, cc}
* src/BtSetup.cc
* src/BtConstants.h
Diffstat (limited to 'src/ActivePeerConnectionCommand.cc')
| -rw-r--r-- | src/ActivePeerConnectionCommand.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ActivePeerConnectionCommand.cc b/src/ActivePeerConnectionCommand.cc index cae26834..f6049ba3 100644 --- a/src/ActivePeerConnectionCommand.cc +++ b/src/ActivePeerConnectionCommand.cc @@ -43,6 +43,9 @@ #include "BtRuntime.h" #include "Peer.h" #include "Logger.h" +#include "prefs.h" +#include "Option.h" +#include "BtConstants.h" namespace aria2 { @@ -50,16 +53,20 @@ ActivePeerConnectionCommand::ActivePeerConnectionCommand(int cuid, RequestGroup* requestGroup, DownloadEngine* e, const BtContextHandle& btContext, - int32_t interval, - int32_t thresholdSpeed) + int32_t interval) :Command(cuid), BtContextAwareCommand(btContext), RequestGroupAware(requestGroup), interval(interval), e(e), - _thresholdSpeed(thresholdSpeed), + _thresholdSpeed(SLOW_SPEED_THRESHOLD), _numNewConnection(5) -{} +{ + int32_t maxDownloadSpeed = e->option->getAsInt(PREF_MAX_DOWNLOAD_LIMIT); + if(maxDownloadSpeed > 0) { + _thresholdSpeed = std::min(maxDownloadSpeed, _thresholdSpeed); + } +} ActivePeerConnectionCommand::~ActivePeerConnectionCommand() {} |
