2007-06-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Accept incoming connections if download rate is low.
	* src/PeerListenCommand.h, src/PeerListenCommand.cc:
	(_lowestSpeedLimit): New variable.
	(setLowestSpeedLimit): New function.
	(execute): Accept incoming connections if download rate is low.
	MAX_PEERS is ignored in this case.

	Disable PREF_OUT in multiple concurrent download:
	* src/RequestGroup.h, src/RequestGroup.cc
	(setUserDefinedFilename): New function.
	* src/DownloadEngineFactory.cc
	(newConsoleEngine): Do not set PREF_OUT to requestGroup in 
multiple
	concurrent download.
	* src/DefaultSegmentManFactory.cc
	(createNewInstance): Comment out the line: segmentMan->ufilename 
= ...
pull/1/head
Tatsuhiro Tsujikawa 2007-06-04 12:52:57 +00:00
parent 47ce21a469
commit 3dd06aacfb
6 changed files with 25 additions and 12 deletions

View File

@ -1,5 +1,5 @@
2007-06-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Accept incoming connections if download rate is low.
* src/PeerListenCommand.h, src/PeerListenCommand.cc:
(_lowestSpeedLimit): New variable.
@ -7,6 +7,15 @@
(execute): Accept incoming connections if download rate is low.
MAX_PEERS is ignored in this case.
Disable PREF_OUT in multiple concurrent download:
* src/RequestGroup.h, src/RequestGroup.cc
(setUserDefinedFilename): New function.
* src/DownloadEngineFactory.cc
(newConsoleEngine): Do not set PREF_OUT to requestGroup in multiple
concurrent download.
* src/DefaultSegmentManFactory.cc
(createNewInstance): Comment out the line: segmentMan->ufilename = ...
2007-06-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
RequestGroup::getNextCommand() was renamed to createNextCommand().

2
TODO
View File

@ -31,7 +31,5 @@
100K/300M(10%)(3cn)(3more) 100KB/s [FileAlloc:35MB/40MB(90%)][Checksum:10MB/20MB(50%)]
* exit status: all downloads have been successful-> EXIT_SUCCESS,
some of downloads have been failed -> EXIT_FAILURE
* Do not use ufilename in multi-simultaneous download mode.
* Create download command directly when 1connection download.
Consider timeout when file allocation/check integrity is enabled.
* Accept incoming connections if download rate is low.

View File

@ -42,7 +42,7 @@ SegmentManHandle DefaultSegmentManFactory::createNewInstance()
segmentMan->diskWriter = new DefaultDiskWriter();
segmentMan->dir = _option->get(PREF_DIR);
// TODO disable this in multi-simultaneous download mode.
segmentMan->ufilename = _option->get(PREF_OUT);
//segmentMan->ufilename = _option->get(PREF_OUT);
segmentMan->option = _option;
return segmentMan;
}

View File

@ -65,6 +65,10 @@ ConsoleDownloadEngine*
DownloadEngineFactory::newConsoleEngine(const Option* op,
const RequestGroups& requestGroups)
{
// set PREF_OUT parameter to requestGroup in non-multi download mode.
if(requestGroups.size() == 1) {
requestGroups.front()->setUserDefinedFilename(op->get(PREF_OUT));
}
RequestGroups workingSet;
RequestGroups reservedSet;
if(op->getAsInt(PREF_MAX_SIMULTANEOUS_DOWNLOADS) < (int32_t)requestGroups.size()) {

View File

@ -50,14 +50,6 @@
SegmentManHandle RequestGroup::initSegmentMan()
{
_segmentMan = _segmentManFactory->createNewInstance();
/*
_segmentMan = new SegmentMan();
_segmentMan->diskWriter = new DefaultDiskWriter();// DefaultDiskWriter::createNewDiskWriter(_option);
_segmentMan->dir = _option->get(PREF_DIR);
// TODO disable this in multi-simultaneous download mode.
_segmentMan->ufilename = _option->get(PREF_OUT);
_segmentMan->option = _option;
*/
return _segmentMan;
}
@ -266,3 +258,11 @@ void RequestGroup::validateTotalLengthByHint(int64_t actualTotalLength) const
{
validateTotalLength(_hintTotalLength, actualTotalLength);
}
void RequestGroup::setUserDefinedFilename(const string& filename)
{
if(_segmentMan.isNull()) {
throw new FatalException("SegmentMan is not initialized yet. Call initSegmentMan() before calling this function.");
}
_segmentMan->ufilename = filename;
}

View File

@ -270,6 +270,8 @@ public:
{
_numConcurrentCommand = num;
}
void setUserDefinedFilename(const string& filename);
};
typedef SharedHandle<RequestGroup> RequestGroupHandle;