summaryrefslogtreecommitdiff
path: root/src/DefaultBtInteractive.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-02-28 11:48:26 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-02-28 11:48:26 +0000
commit0b29a6e2cf4461b20bfdb85d5f5cd635b5ba6b5a (patch)
treef63f712ec29cb963b3270e7bcd7cc24870bb7f77 /src/DefaultBtInteractive.cc
parent362cd20bf117b366dd3c72ce5383e243fa4cd0f1 (diff)
2009-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --max-overall-download-limit option. Now --max-upload-limit option is not ignored when --max-overall-upload-limit option has non-zero value. aria2 checks download(upload) speed in the order: first checks overall speed limit and if it is not exceeded, then checks speed limit per download. Thus you can specify both value. For example, set --max-overall-download-limit=1M and --max-download-limit=500K to prevent from one download from eating all overall speed limit. * src/DefaultBtInteractive.cc * src/DefaultBtInteractive.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DownloadCommand.cc * src/DownloadCommand.h * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.cc * src/OptionHandlerFactory.cc * src/PeerInteractionCommand.cc * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupMan.cc * src/RequestGroupMan.h * src/prefs.cc * src/prefs.h * src/usage_text.h * test/DefaultBtMessageDispatcherTest.cc
Diffstat (limited to 'src/DefaultBtInteractive.cc')
-rw-r--r--src/DefaultBtInteractive.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/DefaultBtInteractive.cc b/src/DefaultBtInteractive.cc
index a32a6c3a..e3f43d2d 100644
--- a/src/DefaultBtInteractive.cc
+++ b/src/DefaultBtInteractive.cc
@@ -66,6 +66,7 @@
#include "LogFactory.h"
#include "StringFormat.h"
#include "RequestGroup.h"
+#include "RequestGroupMan.h"
namespace aria2 {
@@ -77,7 +78,6 @@ DefaultBtInteractive::DefaultBtInteractive
logger(LogFactory::getInstance()),
allowedFastSetSize(10),
keepAliveInterval(120),
- maxDownloadSpeedLimit(0),
_utPexEnabled(false),
_dhtEnabled(false),
_numReceivedMessage(0)
@@ -237,11 +237,9 @@ void DefaultBtInteractive::sendKeepAlive() {
size_t DefaultBtInteractive::receiveMessages() {
size_t msgcount = 0;
for(int i = 0; i < 50; i++) {
- if(maxDownloadSpeedLimit > 0) {
- TransferStat stat = _btContext->getOwnerRequestGroup()->calculateStat();
- if(maxDownloadSpeedLimit < stat.downloadSpeed) {
- break;
- }
+ if(_requestGroupMan->doesOverallDownloadSpeedExceed() ||
+ _btContext->getOwnerRequestGroup()->doesDownloadSpeedExceed()) {
+ break;
}
BtMessageHandle message = btMessageReceiver->receiveMessage();
if(message.isNull()) {
@@ -544,4 +542,10 @@ void DefaultBtInteractive::setBtMessageFactory
this->messageFactory = factory;
}
+void DefaultBtInteractive::setRequestGroupMan
+(const WeakHandle<RequestGroupMan>& rgman)
+{
+ _requestGroupMan = rgman;
+}
+
} // namespace aria2