2008-09-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Fixed the bug that aria2 downloads faster than 
max-download-limit when
	downloading file using both HTTP(or FTP) and BitTorrent, because 
aria2
	evaluates speed separatly(HTTP and BiTorrent) against 
max-download-limit
	, instead of sum of them.
	* src/ActivePeerConnectionCommand.cc
	* src/DefaultBtInteractive.cc
	* src/DownloadCommand.cc
	* src/PeerInteractionCommand.cc
	* src/PeerReceiveHandshakeCommand.cc
pull/1/head
Tatsuhiro Tsujikawa 2008-09-28 05:07:52 +00:00
parent e9e215dc1f
commit db5944b29b
6 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,15 @@
2008-09-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that aria2 downloads faster than max-download-limit when
downloading file using both HTTP(or FTP) and BitTorrent, because aria2
evaluates speed separatly(HTTP and BiTorrent) against max-download-limit
, instead of sum of them.
* src/ActivePeerConnectionCommand.cc
* src/DefaultBtInteractive.cc
* src/DownloadCommand.cc
* src/PeerInteractionCommand.cc
* src/PeerReceiveHandshakeCommand.cc
2008-09-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that HTTPS download fails.

View File

@ -48,6 +48,7 @@
#include "BtConstants.h"
#include "SocketCore.h"
#include "BtAnnounce.h"
#include "RequestGroup.h"
namespace aria2 {
@ -79,7 +80,7 @@ bool ActivePeerConnectionCommand::execute() {
}
if(checkPoint.elapsed(interval)) {
checkPoint.reset();
TransferStat tstat = peerStorage->calculateStat();
TransferStat tstat = _requestGroup->calculateStat();
if(// for seeder state
(pieceStorage->downloadFinished() && btRuntime->lessThanMaxPeers() &&
(_maxUploadSpeedLimit == 0 ||

View File

@ -65,6 +65,7 @@
#include "Logger.h"
#include "LogFactory.h"
#include "StringFormat.h"
#include "RequestGroup.h"
#include <cstring>
namespace aria2 {
@ -234,7 +235,7 @@ size_t DefaultBtInteractive::receiveMessages() {
size_t msgcount = 0;
for(int i = 0; i < 50; i++) {
if(maxDownloadSpeedLimit > 0) {
TransferStat stat = peerStorage->calculateStat();
TransferStat stat = btContext->getOwnerRequestGroup()->calculateStat();
if(maxDownloadSpeedLimit < stat.downloadSpeed) {
break;
}

View File

@ -101,7 +101,8 @@ DownloadCommand::~DownloadCommand() {
bool DownloadCommand::executeInternal() {
if(maxDownloadSpeedLimit > 0 &&
maxDownloadSpeedLimit < _requestGroup->getSegmentMan()->calculateDownloadSpeed()) {
maxDownloadSpeedLimit <
_requestGroup->calculateStat().getDownloadSpeed()) {
e->commands.push_back(this);
disableReadCheckSocket();
return false;

View File

@ -239,7 +239,7 @@ bool PeerInteractionCommand::executeInternal() {
// }
if(maxDownloadSpeedLimit > 0) {
TransferStat stat = peerStorage->calculateStat();
TransferStat stat = _requestGroup->calculateStat();
if(maxDownloadSpeedLimit < stat.downloadSpeed) {
disableReadCheckSocket();
setNoCheck(true);

View File

@ -53,6 +53,7 @@
#include "Option.h"
#include "RequestGroupMan.h"
#include "StringFormat.h"
#include "RequestGroup.h"
namespace aria2 {
@ -97,7 +98,7 @@ bool PeerReceiveHandshakeCommand::executeInternal()
throw DlAbortEx
(StringFormat("Unknown info hash %s", infoHash.c_str()).str());
}
TransferStat tstat = PEER_STORAGE(btContext)->calculateStat();
TransferStat tstat = btContext->getOwnerRequestGroup()->calculateStat();
if((!PIECE_STORAGE(btContext)->downloadFinished() &&
tstat.getDownloadSpeed() < _thresholdSpeed) ||
BT_RUNTIME(btContext)->lessThanMaxPeers()) {