From b4f7588ba285a8e33dc07acfa730491285cba18e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 7 Nov 2007 12:36:33 +0000 Subject: 2007-11-07 Tatsuhiro Tsujikawa Reflect the download length of in-flight pieces. It makes the download length readout more precise. * src/DefaultPieceStorage.{h, cc} * test/DefaultPieceStorageTest.cc * src/a2functional.h * test/a2functionalTest.cc Lower CPU load when --max-download-limit is used. There is up and down in speed indicator when enabling http-pipelining but a download goes well. I think the problem is that because http-pipelining is enabled, DownloadCommand is created for each segment and in its constructor, PeerStat::downloadStart() is called. In PeerStat::downloadStart(), speed calculation object is reseted, which makes download speed zero. * src/DownloadCommand.cc Rewritten using accumulate. * src/RequestGroupMan.cc (calculateStat) Code clearnup. * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.cc --- src/DownloadCommand.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/DownloadCommand.cc') diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc index 9e4cb943..9252911b 100644 --- a/src/DownloadCommand.cc +++ b/src/DownloadCommand.cc @@ -79,10 +79,11 @@ bool DownloadCommand::executeInternal() { // TODO we need to specify the sum of all segmentMan's download speed here. if(maxDownloadSpeedLimit > 0 && maxDownloadSpeedLimit < _requestGroup->getSegmentMan()->calculateDownloadSpeed()) { - Util::usleep(1); e->commands.push_back(this); + disableReadCheckSocket(); return false; } + setReadCheckSocket(socket); SegmentHandle segment = _segments.front(); int32_t BUFSIZE = 16*1024; -- cgit