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> 2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten DownloadContext and removed SingleFileDownloadContext Rewritten DownloadContext and removed SingleFileDownloadContext

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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