2007-02-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

To lower CPU usage in BitTorrent download when 
--max-upload-limit
	command-line option specified:
	
	* src/DefaultBtMessageDispatcher.cc
	(sendMessages): Calculate uploading speed only when current 
message
	is uploading data and is not sent yet.
	
	* src/DefaultPeerStorage.h
	(MAX_PEER_LIST_SIZE): 100 -> 60, because 60 is well enough.

	* src/HttpResponseCommand.cc
	(handleDefaultEncoding): Added the cast to int32_t to itos.
	This fixes compile error in Soralis 10.
pull/1/head
Tatsuhiro Tsujikawa 2007-02-03 04:17:22 +00:00
parent 77a05c00b1
commit a4e7bd7ec4
4 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,19 @@
2007-02-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To lower CPU usage in BitTorrent download when --max-upload-limit
command-line option specified:
* src/DefaultBtMessageDispatcher.cc
(sendMessages): Calculate uploading speed only when current message
is uploading data and is not sent yet.
* src/DefaultPeerStorage.h
(MAX_PEER_LIST_SIZE): 100 -> 60, because 60 is well enough.
* src/HttpResponseCommand.cc
(handleDefaultEncoding): Added the cast to int32_t to itos.
This fixes compile error in Soralis 10.
2007-01-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To fix segfault in Metalink download:

View File

@ -61,10 +61,10 @@ void DefaultBtMessageDispatcher::sendMessages() {
while(messageQueue.size() > 0) {
BtMessageHandle msg = messageQueue.front();
messageQueue.pop_front();
if(maxUploadSpeedLimit > 0) {
if(maxUploadSpeedLimit > 0 &&
msg->isUploading() && !msg->isSendingInProgress()) {
TransferStat stat = peerStorage->calculateStat();
if(maxUploadSpeedLimit < stat.getUploadSpeed() &&
msg->isUploading() && !msg->isSendingInProgress()) {
if(maxUploadSpeedLimit < stat.getUploadSpeed()) {
tempQueue.push_back(msg);
continue;
}

View File

@ -41,7 +41,7 @@
#include "Logger.h"
#include "BtRuntime.h"
#define MAX_PEER_LIST_SIZE 100
#define MAX_PEER_LIST_SIZE 60
#define MAX_PEER_ERROR 5
class DefaultPeerStorage : public PeerStorage {

View File

@ -145,7 +145,7 @@ bool HttpResponseCommand::handleDefaultEncoding(const HttpHeader& headers) {
req->setKeepAlive(false);
e->segmentMan->isSplittable = false;
e->segmentMan->downloadStarted = true;
e->segmentMan->diskWriter->initAndOpenFile("/tmp/aria2"+Util::itos(getpid()));
e->segmentMan->diskWriter->initAndOpenFile("/tmp/aria2"+Util::itos((int32_t)getpid()));
createHttpDownloadCommand();
return true;
}