2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Removed _currentRequest from StreamCheckIntegrityEntry and
	StreamFileAllocationEntry.
	* src/AbstractCommand.cc
	* src/HttpResponseCommand.cc
	* src/RequestGroup.cc
	* src/StreamCheckIntegrityEntry.cc
	* src/StreamCheckIntegrityEntry.h
	* src/StreamFileAllocationEntry.cc
	* src/StreamFileAllocationEntry.h
pull/1/head
Tatsuhiro Tsujikawa 2009-06-28 10:48:26 +00:00
parent 5699b67526
commit d2afc0ca8e
8 changed files with 27 additions and 29 deletions

View File

@ -1,3 +1,15 @@
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed _currentRequest from StreamCheckIntegrityEntry and
StreamFileAllocationEntry.
* src/AbstractCommand.cc
* src/HttpResponseCommand.cc
* src/RequestGroup.cc
* src/StreamCheckIntegrityEntry.cc
* src/StreamCheckIntegrityEntry.h
* src/StreamFileAllocationEntry.cc
* src/StreamFileAllocationEntry.h
2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten DownloadContext and removed SingleFileDownloadContext

View File

@ -525,7 +525,8 @@ bool AbstractCommand::nameResolveFinished() const {
void AbstractCommand::prepareForNextAction(Command* nextCommand)
{
CheckIntegrityEntryHandle entry(new StreamCheckIntegrityEntry(req, _requestGroup, nextCommand));
CheckIntegrityEntryHandle entry
(new StreamCheckIntegrityEntry(_requestGroup, nextCommand));
std::deque<Command*> commands;
_requestGroup->processCheckIntegrityEntry(commands, entry, e);

View File

@ -122,12 +122,12 @@ bool HttpResponseCommand::executeInternal()
return skipResponseBody(httpResponse);
}
if(!_requestGroup->isSingleHostMultiConnectionEnabled()) {
// Query by hostname. Searching by CUID may returns NULL.
// In case when resuming download, ServerHost is registered with CUID A.
// Query by hostname. Searching by CUID may returns NULL. In case
// when resuming download, ServerHost is registered with CUID A.
// Then if requested range is not equal to saved one,
// StreamFileAllocationEntry is created with _nextCommand NULL and
// _currentRequest not NULL. This results creating new command CUID, say
// B and same URI. So searching ServerHost by CUID B fails.
// StreamFileAllocationEntry is created with _nextCommand NULL.
// This results creating new command CUID, say B and same URI. So
// searching ServerHost by CUID B fails.
SharedHandle<ServerHost> sv =
_requestGroup->searchServerHost(req->getHost());
if(!sv.isNull()) {

View File

@ -380,7 +380,7 @@ void RequestGroup::createInitialCommand(std::deque<Command*>& commands,
} else {
loadAndOpenFile(infoFile);
SharedHandle<CheckIntegrityEntry> checkIntegrityEntry
(new StreamCheckIntegrityEntry(SharedHandle<Request>(), this));
(new StreamCheckIntegrityEntry(this));
processCheckIntegrityEntry(commands, checkIntegrityEntry, e);
}
}

View File

@ -36,16 +36,13 @@
#include "RequestGroup.h"
#include "DownloadEngine.h"
#include "StreamFileAllocationEntry.h"
#include "Request.h"
#include "DownloadContext.h"
namespace aria2 {
StreamCheckIntegrityEntry::StreamCheckIntegrityEntry(const RequestHandle& currentRequest,
RequestGroup* requestGroup,
StreamCheckIntegrityEntry::StreamCheckIntegrityEntry(RequestGroup* requestGroup,
Command* nextCommand):
PieceHashCheckIntegrityEntry(requestGroup, nextCommand),
_currentRequest(currentRequest)
PieceHashCheckIntegrityEntry(requestGroup, nextCommand)
{}
StreamCheckIntegrityEntry::~StreamCheckIntegrityEntry() {}
@ -54,8 +51,7 @@ void StreamCheckIntegrityEntry::onDownloadIncomplete
(std::deque<Command*>& commands, DownloadEngine* e)
{
FileAllocationEntryHandle entry
(new StreamFileAllocationEntry(_currentRequest, _requestGroup,
popNextCommand()));
(new StreamFileAllocationEntry(_requestGroup, popNextCommand()));
proceedFileAllocation(commands, entry, e);
}

View File

@ -40,16 +40,12 @@
namespace aria2 {
class Request;
class StreamCheckIntegrityEntry:public PieceHashCheckIntegrityEntry
{
private:
SharedHandle<Request> _currentRequest;
Time _timer;
public:
StreamCheckIntegrityEntry(const SharedHandle<Request>& currentRequest,
RequestGroup* requestGroup,
StreamCheckIntegrityEntry(RequestGroup* requestGroup,
Command* nextCommand = 0);
virtual ~StreamCheckIntegrityEntry();

View File

@ -38,7 +38,6 @@
#include "DownloadEngine.h"
#include "Option.h"
#include "Request.h"
#include "prefs.h"
#include "RequestGroup.h"
#include "DownloadContext.h"
@ -46,11 +45,9 @@
namespace aria2 {
StreamFileAllocationEntry::StreamFileAllocationEntry(const RequestHandle& currentRequest,
RequestGroup* requestGroup,
StreamFileAllocationEntry::StreamFileAllocationEntry(RequestGroup* requestGroup,
Command* nextCommand):
FileAllocationEntry(requestGroup, nextCommand),
_currentRequest(currentRequest)
FileAllocationEntry(requestGroup, nextCommand)
{}
StreamFileAllocationEntry::~StreamFileAllocationEntry() {}

View File

@ -40,15 +40,11 @@
namespace aria2 {
class Request;
class StreamFileAllocationEntry : public FileAllocationEntry {
private:
SharedHandle<Request> _currentRequest;
Time _timer;
public:
StreamFileAllocationEntry(const SharedHandle<Request>& currentRequest,
RequestGroup* requestGroup,
StreamFileAllocationEntry(RequestGroup* requestGroup,
Command* nextCommand = 0);
virtual ~StreamFileAllocationEntry();