mirror of https://github.com/aria2/aria2
2009-04-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed RequestGroupAware * src/AbstractCommand.cc * src/AbstractCommand.h * src/ActivePeerConnectionCommand.cc * src/ActivePeerConnectionCommand.h * src/DHTGetPeersCommand.cc * src/DHTGetPeersCommand.h * src/InitiatorMSEHandshakeCommand.cc * src/InitiatorMSEHandshakeCommand.h * src/Makefile.am * src/PeerInitiateConnectionCommand.cc * src/PeerInitiateConnectionCommand.h * src/PeerInteractionCommand.cc * src/PeerInteractionCommand.h * src/RealtimeCommand.cc * src/RealtimeCommand.h * src/RequestGroupAware.cc: Removed * src/RequestGroupAware.h: Removed * src/SeedCheckCommand.cc * src/SeedCheckCommand.h * src/SleepCommand.cc * src/TrackerWatcherCommand.cc * src/TrackerWatcherCommand.hpull/1/head
parent
6703097652
commit
3955054837
26
ChangeLog
26
ChangeLog
|
@ -1,3 +1,29 @@
|
|||
2009-04-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed RequestGroupAware
|
||||
* src/AbstractCommand.cc
|
||||
* src/AbstractCommand.h
|
||||
* src/ActivePeerConnectionCommand.cc
|
||||
* src/ActivePeerConnectionCommand.h
|
||||
* src/DHTGetPeersCommand.cc
|
||||
* src/DHTGetPeersCommand.h
|
||||
* src/InitiatorMSEHandshakeCommand.cc
|
||||
* src/InitiatorMSEHandshakeCommand.h
|
||||
* src/Makefile.am
|
||||
* src/PeerInitiateConnectionCommand.cc
|
||||
* src/PeerInitiateConnectionCommand.h
|
||||
* src/PeerInteractionCommand.cc
|
||||
* src/PeerInteractionCommand.h
|
||||
* src/RealtimeCommand.cc
|
||||
* src/RealtimeCommand.h
|
||||
* src/RequestGroupAware.cc: Removed
|
||||
* src/RequestGroupAware.h: Removed
|
||||
* src/SeedCheckCommand.cc
|
||||
* src/SeedCheckCommand.h
|
||||
* src/SleepCommand.cc
|
||||
* src/TrackerWatcherCommand.cc
|
||||
* src/TrackerWatcherCommand.h
|
||||
|
||||
2009-04-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Rewritten PeerListProcessor
|
||||
|
|
|
@ -70,7 +70,7 @@ AbstractCommand::AbstractCommand(int32_t cuid,
|
|||
RequestGroup* requestGroup,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s):
|
||||
Command(cuid), RequestGroupAware(requestGroup),
|
||||
Command(cuid), _requestGroup(requestGroup),
|
||||
req(req), e(e), socket(s),
|
||||
checkSocketIsReadable(false), checkSocketIsWritable(false),
|
||||
nameResolverCheck(false)
|
||||
|
@ -80,6 +80,7 @@ AbstractCommand::AbstractCommand(int32_t cuid,
|
|||
}
|
||||
timeout = _requestGroup->getTimeout();
|
||||
_requestGroup->increaseStreamConnection();
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
AbstractCommand::~AbstractCommand() {
|
||||
|
@ -88,6 +89,7 @@ AbstractCommand::~AbstractCommand() {
|
|||
#ifdef ENABLE_ASYNC_DNS
|
||||
disableNameResolverCheck(_asyncNameResolver);
|
||||
#endif // ENABLE_ASYNC_DNS
|
||||
_requestGroup->decreaseNumCommand();
|
||||
_requestGroup->decreaseStreamConnection();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "Command.h"
|
||||
#include "SharedHandle.h"
|
||||
#include "TimeA2.h"
|
||||
#include "RequestGroupAware.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -52,11 +51,12 @@ class SocketCore;
|
|||
class AsyncNameResolver;
|
||||
#endif // ENABLE_ASYNC_DNS
|
||||
|
||||
class AbstractCommand : public Command, public RequestGroupAware {
|
||||
class AbstractCommand : public Command {
|
||||
private:
|
||||
Time checkPoint;
|
||||
time_t timeout;
|
||||
protected:
|
||||
RequestGroup* _requestGroup;
|
||||
SharedHandle<Request> req;
|
||||
DownloadEngine* e;
|
||||
SharedHandle<SocketCore> socket;
|
||||
|
|
|
@ -59,7 +59,7 @@ ActivePeerConnectionCommand::ActivePeerConnectionCommand
|
|||
time_t interval)
|
||||
:
|
||||
Command(cuid),
|
||||
RequestGroupAware(requestGroup),
|
||||
_requestGroup(requestGroup),
|
||||
_btContext(btContext),
|
||||
interval(interval),
|
||||
e(e),
|
||||
|
@ -71,9 +71,13 @@ ActivePeerConnectionCommand::ActivePeerConnectionCommand
|
|||
if(maxDownloadSpeed > 0) {
|
||||
_thresholdSpeed = std::min(maxDownloadSpeed, _thresholdSpeed);
|
||||
}
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
ActivePeerConnectionCommand::~ActivePeerConnectionCommand() {}
|
||||
ActivePeerConnectionCommand::~ActivePeerConnectionCommand()
|
||||
{
|
||||
_requestGroup->decreaseNumCommand();
|
||||
}
|
||||
|
||||
bool ActivePeerConnectionCommand::execute() {
|
||||
if(_btRuntime->isHalt()) {
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
|
||||
#include "Command.h"
|
||||
#include "SharedHandle.h"
|
||||
#include "RequestGroupAware.h"
|
||||
#include "TimeA2.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class RequestGroup;
|
||||
class DownloadEngine;
|
||||
class Peer;
|
||||
class BtContext;
|
||||
|
@ -50,10 +50,9 @@ class PieceStorage;
|
|||
class PeerStorage;
|
||||
class BtAnnounce;
|
||||
|
||||
class ActivePeerConnectionCommand : public Command,
|
||||
public RequestGroupAware
|
||||
{
|
||||
class ActivePeerConnectionCommand : public Command {
|
||||
private:
|
||||
RequestGroup* _requestGroup;
|
||||
SharedHandle<BtContext> _btContext;
|
||||
SharedHandle<BtRuntime> _btRuntime;
|
||||
SharedHandle<PieceStorage> _pieceStorage;
|
||||
|
@ -72,9 +71,9 @@ public:
|
|||
DownloadEngine* e,
|
||||
const SharedHandle<BtContext>& btContext,
|
||||
time_t interval);
|
||||
|
||||
virtual ~ActivePeerConnectionCommand();
|
||||
|
||||
virtual ~ActivePeerConnectionCommand();
|
||||
|
||||
virtual bool execute();
|
||||
|
||||
void connectToPeer(const SharedHandle<Peer>& peer);
|
||||
|
|
|
@ -53,14 +53,19 @@ DHTGetPeersCommand::DHTGetPeersCommand(int32_t cuid,
|
|||
DownloadEngine* e,
|
||||
const BtContextHandle& ctx):
|
||||
Command(cuid),
|
||||
RequestGroupAware(requestGroup),
|
||||
_requestGroup(requestGroup),
|
||||
_btContext(ctx),
|
||||
_e(e),
|
||||
_numRetry(0),
|
||||
_lastGetPeerTime(0)
|
||||
{}
|
||||
{
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
DHTGetPeersCommand::~DHTGetPeersCommand() {}
|
||||
DHTGetPeersCommand::~DHTGetPeersCommand()
|
||||
{
|
||||
_requestGroup->decreaseNumCommand();
|
||||
}
|
||||
|
||||
bool DHTGetPeersCommand::execute()
|
||||
{
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
#define _D_DHT_GET_PEERS_COMMAND_H_
|
||||
|
||||
#include "Command.h"
|
||||
#include "RequestGroupAware.h"
|
||||
#include "SharedHandle.h"
|
||||
#include "TimeA2.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class RequestGroup;
|
||||
class DHTTaskQueue;
|
||||
class DHTTaskFactory;
|
||||
class DHTTask;
|
||||
|
@ -51,9 +51,7 @@ class BtContext;
|
|||
class BtRuntime;
|
||||
class PeerStorage;
|
||||
|
||||
class DHTGetPeersCommand:public Command,
|
||||
public RequestGroupAware
|
||||
{
|
||||
class DHTGetPeersCommand:public Command {
|
||||
private:
|
||||
static const time_t GET_PEER_INTERVAL = (15*60);
|
||||
|
||||
|
@ -61,6 +59,8 @@ private:
|
|||
|
||||
static const size_t MAX_RETRIES = 10;
|
||||
|
||||
RequestGroup* _requestGroup;
|
||||
|
||||
SharedHandle<BtContext> _btContext;
|
||||
|
||||
SharedHandle<BtRuntime> _btRuntime;
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "MSEHandshake.h"
|
||||
#include "ARC4Encryptor.h"
|
||||
#include "ARC4Decryptor.h"
|
||||
#include "RequestGroup.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -64,7 +65,7 @@ InitiatorMSEHandshakeCommand::InitiatorMSEHandshakeCommand
|
|||
const SharedHandle<SocketCore>& s):
|
||||
|
||||
PeerAbstractCommand(cuid, p, e, s),
|
||||
RequestGroupAware(requestGroup),
|
||||
_requestGroup(requestGroup),
|
||||
_btContext(btContext),
|
||||
_btRuntime(btRuntime),
|
||||
_sequence(INITIATOR_SEND_KEY),
|
||||
|
@ -75,10 +76,12 @@ InitiatorMSEHandshakeCommand::InitiatorMSEHandshakeCommand
|
|||
setTimeout(e->option->getAsInt(PREF_PEER_CONNECTION_TIMEOUT));
|
||||
|
||||
_btRuntime->increaseConnections();
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
InitiatorMSEHandshakeCommand::~InitiatorMSEHandshakeCommand()
|
||||
{
|
||||
_requestGroup->decreaseNumCommand();
|
||||
_btRuntime->decreaseConnections();
|
||||
|
||||
delete _mseHandshake;
|
||||
|
|
|
@ -36,19 +36,17 @@
|
|||
#define _D_INITIATOR_MSE_HANDSHAKE_COMMAND_H_
|
||||
|
||||
#include "PeerAbstractCommand.h"
|
||||
#include "RequestGroupAware.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class RequestGroup;
|
||||
class BtContext;
|
||||
class PeerStorage;
|
||||
class PieceStorage;
|
||||
class BtRuntime;
|
||||
class MSEHandshake;
|
||||
|
||||
class InitiatorMSEHandshakeCommand : public PeerAbstractCommand,
|
||||
public RequestGroupAware
|
||||
{
|
||||
class InitiatorMSEHandshakeCommand : public PeerAbstractCommand {
|
||||
public:
|
||||
enum Seq {
|
||||
INITIATOR_SEND_KEY,
|
||||
|
@ -60,6 +58,8 @@ public:
|
|||
INITIATOR_RECEIVE_PAD_D,
|
||||
};
|
||||
private:
|
||||
RequestGroup* _requestGroup;
|
||||
|
||||
SharedHandle<BtContext> _btContext;
|
||||
|
||||
SharedHandle<PeerStorage> _peerStorage;
|
||||
|
|
|
@ -82,7 +82,6 @@ SRCS = Socket.h\
|
|||
NameMatchOptionHandler.h\
|
||||
NameResolver.cc NameResolver.h\
|
||||
RequestGroup.cc RequestGroup.h\
|
||||
RequestGroupAware.cc RequestGroupAware.h\
|
||||
RequestGroupMan.cc RequestGroupMan.h\
|
||||
FileAllocationMan.h\
|
||||
FileAllocationCommand.cc FileAllocationCommand.h\
|
||||
|
|
|
@ -333,9 +333,8 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
OptionHandlerFactory.cc OptionHandlerFactory.h \
|
||||
OptionHandler.cc OptionHandler.h OptionHandlerImpl.h \
|
||||
NameMatchOptionHandler.h NameResolver.cc NameResolver.h \
|
||||
RequestGroup.cc RequestGroup.h RequestGroupAware.cc \
|
||||
RequestGroupAware.h RequestGroupMan.cc RequestGroupMan.h \
|
||||
FileAllocationMan.h FileAllocationCommand.cc \
|
||||
RequestGroup.cc RequestGroup.h RequestGroupMan.cc \
|
||||
RequestGroupMan.h FileAllocationMan.h FileAllocationCommand.cc \
|
||||
FileAllocationCommand.h FillRequestGroupCommand.cc \
|
||||
FillRequestGroupCommand.h FileAllocationDispatcherCommand.cc \
|
||||
FileAllocationDispatcherCommand.h FileAllocationEntry.cc \
|
||||
|
@ -760,8 +759,7 @@ am__objects_23 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
|||
AuthConfigFactory.$(OBJEXT) OptionParser.$(OBJEXT) \
|
||||
OptionHandlerFactory.$(OBJEXT) OptionHandler.$(OBJEXT) \
|
||||
NameResolver.$(OBJEXT) RequestGroup.$(OBJEXT) \
|
||||
RequestGroupAware.$(OBJEXT) RequestGroupMan.$(OBJEXT) \
|
||||
FileAllocationCommand.$(OBJEXT) \
|
||||
RequestGroupMan.$(OBJEXT) FileAllocationCommand.$(OBJEXT) \
|
||||
FillRequestGroupCommand.$(OBJEXT) \
|
||||
FileAllocationDispatcherCommand.$(OBJEXT) \
|
||||
FileAllocationEntry.$(OBJEXT) \
|
||||
|
@ -1066,9 +1064,8 @@ SRCS = Socket.h SocketCore.cc SocketCore.h BinaryStream.h Command.cc \
|
|||
OptionHandlerFactory.cc OptionHandlerFactory.h \
|
||||
OptionHandler.cc OptionHandler.h OptionHandlerImpl.h \
|
||||
NameMatchOptionHandler.h NameResolver.cc NameResolver.h \
|
||||
RequestGroup.cc RequestGroup.h RequestGroupAware.cc \
|
||||
RequestGroupAware.h RequestGroupMan.cc RequestGroupMan.h \
|
||||
FileAllocationMan.h FileAllocationCommand.cc \
|
||||
RequestGroup.cc RequestGroup.h RequestGroupMan.cc \
|
||||
RequestGroupMan.h FileAllocationMan.h FileAllocationCommand.cc \
|
||||
FileAllocationCommand.h FillRequestGroupCommand.cc \
|
||||
FillRequestGroupCommand.h FileAllocationDispatcherCommand.cc \
|
||||
FileAllocationDispatcherCommand.h FileAllocationEntry.cc \
|
||||
|
@ -1481,7 +1478,6 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ReceiverMSEHandshakeCommand.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Request.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestGroup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestGroupAware.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestGroupEntry.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestGroupMan.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestSlot.Po@am__quote@
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "PeerStorage.h"
|
||||
#include "PieceStorage.h"
|
||||
#include "PeerConnection.h"
|
||||
#include "RequestGroup.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -60,16 +61,18 @@ PeerInitiateConnectionCommand::PeerInitiateConnectionCommand
|
|||
bool mseHandshakeEnabled)
|
||||
:
|
||||
PeerAbstractCommand(cuid, peer, e),
|
||||
RequestGroupAware(requestGroup),
|
||||
_requestGroup(requestGroup),
|
||||
_btContext(btContext),
|
||||
_btRuntime(btRuntime),
|
||||
_mseHandshakeEnabled(mseHandshakeEnabled)
|
||||
{
|
||||
_btRuntime->increaseConnections();
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
PeerInitiateConnectionCommand::~PeerInitiateConnectionCommand()
|
||||
{
|
||||
_requestGroup->decreaseNumCommand();
|
||||
_btRuntime->decreaseConnections();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,19 +36,19 @@
|
|||
#define _D_PEER_INITIATE_CONNECTION_H_
|
||||
|
||||
#include "PeerAbstractCommand.h"
|
||||
#include "RequestGroupAware.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class RequestGroup;
|
||||
class BtContext;
|
||||
class BtRuntime;
|
||||
class PeerStorage;
|
||||
class PieceStorage;
|
||||
|
||||
class PeerInitiateConnectionCommand : public PeerAbstractCommand,
|
||||
public RequestGroupAware
|
||||
{
|
||||
class PeerInitiateConnectionCommand : public PeerAbstractCommand {
|
||||
private:
|
||||
RequestGroup* _requestGroup;
|
||||
|
||||
SharedHandle<BtContext> _btContext;
|
||||
|
||||
SharedHandle<BtRuntime> _btRuntime;
|
||||
|
|
|
@ -84,7 +84,7 @@ PeerInteractionCommand::PeerInteractionCommand
|
|||
Seq sequence,
|
||||
const PeerConnectionHandle& passedPeerConnection)
|
||||
:PeerAbstractCommand(cuid, p, e, s),
|
||||
RequestGroupAware(requestGroup),
|
||||
_requestGroup(requestGroup),
|
||||
_btContext(btContext),
|
||||
_btRuntime(btRuntime),
|
||||
_pieceStorage(pieceStorage),
|
||||
|
@ -193,6 +193,7 @@ PeerInteractionCommand::PeerInteractionCommand
|
|||
maxDownloadSpeedLimit = e->option->getAsInt(PREF_MAX_DOWNLOAD_LIMIT);
|
||||
|
||||
_btRuntime->increaseConnections();
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
PeerInteractionCommand::~PeerInteractionCommand() {
|
||||
|
@ -201,7 +202,8 @@ PeerInteractionCommand::~PeerInteractionCommand() {
|
|||
peer->getBitfieldLength());
|
||||
}
|
||||
peer->releaseSessionResource();
|
||||
|
||||
|
||||
_requestGroup->decreaseNumCommand();
|
||||
_btRuntime->decreaseConnections();
|
||||
//logger->debug("CUID#%d - unregistered message factory using ID:%s",
|
||||
//cuid, peer->getId().c_str());
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
#define _D_PEER_INTERACTION_COMMAND_H_
|
||||
|
||||
#include "PeerAbstractCommand.h"
|
||||
#include "RequestGroupAware.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class RequestGroup;
|
||||
class BtContext;
|
||||
class BtInteractive;
|
||||
class PeerConnection;
|
||||
|
@ -47,9 +47,7 @@ class BtRuntime;
|
|||
class PeerStorage;
|
||||
class PieceStorage;
|
||||
|
||||
class PeerInteractionCommand : public PeerAbstractCommand,
|
||||
public RequestGroupAware
|
||||
{
|
||||
class PeerInteractionCommand : public PeerAbstractCommand {
|
||||
public:
|
||||
enum Seq {
|
||||
INITIATOR_SEND_HANDSHAKE,
|
||||
|
@ -57,6 +55,8 @@ public:
|
|||
RECEIVER_WAIT_HANDSHAKE,
|
||||
WIRED};
|
||||
private:
|
||||
RequestGroup* _requestGroup;
|
||||
|
||||
SharedHandle<BtContext> _btContext;
|
||||
|
||||
SharedHandle<BtRuntime> _btRuntime;
|
||||
|
|
|
@ -35,16 +35,24 @@
|
|||
#include "RealtimeCommand.h"
|
||||
#include "DownloadEngine.h"
|
||||
#include "Exception.h"
|
||||
#include "RequestGroup.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
RealtimeCommand::RealtimeCommand(int cuid, RequestGroup* requestGroup,
|
||||
DownloadEngine* e):
|
||||
Command(cuid),
|
||||
RequestGroupAware(requestGroup),
|
||||
_requestGroup(requestGroup),
|
||||
_e(e)
|
||||
{
|
||||
setStatusRealtime();
|
||||
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
RealtimeCommand::~RealtimeCommand()
|
||||
{
|
||||
_requestGroup->decreaseNumCommand();
|
||||
}
|
||||
|
||||
bool RealtimeCommand::execute()
|
||||
|
|
|
@ -36,20 +36,21 @@
|
|||
#define _D_REALTIME_COMMAND_H_
|
||||
|
||||
#include "Command.h"
|
||||
#include "RequestGroupAware.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class RequestGroup;
|
||||
class DownloadEngine;
|
||||
class Exception;
|
||||
|
||||
class RealtimeCommand : public Command, public RequestGroupAware {
|
||||
class RealtimeCommand : public Command {
|
||||
protected:
|
||||
RequestGroup* _requestGroup;
|
||||
DownloadEngine* _e;
|
||||
public:
|
||||
RealtimeCommand(int cuid, RequestGroup* requestGroup, DownloadEngine* e);
|
||||
|
||||
virtual ~RealtimeCommand() {}
|
||||
virtual ~RealtimeCommand();
|
||||
|
||||
virtual bool execute();
|
||||
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
/* <!-- copyright */
|
||||
/*
|
||||
* aria2 - The high speed download utility
|
||||
*
|
||||
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give
|
||||
* permission to link the code of portions of this program with the
|
||||
* OpenSSL library under certain conditions as described in each
|
||||
* individual source file, and distribute linked combinations
|
||||
* including the two.
|
||||
* You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than OpenSSL. If you modify
|
||||
* file(s) with this exception, you may extend this exception to your
|
||||
* version of the file(s), but you are not obligated to do so. If you
|
||||
* do not wish to do so, delete this exception statement from your
|
||||
* version. If you delete this exception statement from all source
|
||||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#include "RequestGroupAware.h"
|
||||
#include "RequestGroup.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
RequestGroupAware::RequestGroupAware(RequestGroup* requestGroup):
|
||||
_requestGroup(requestGroup)
|
||||
{
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
RequestGroupAware::~RequestGroupAware()
|
||||
{
|
||||
_requestGroup->decreaseNumCommand();
|
||||
}
|
||||
|
||||
RequestGroup* RequestGroupAware::getRequestGroup() const
|
||||
{
|
||||
return _requestGroup;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
|
@ -1,57 +0,0 @@
|
|||
/* <!-- copyright */
|
||||
/*
|
||||
* aria2 - The high speed download utility
|
||||
*
|
||||
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give
|
||||
* permission to link the code of portions of this program with the
|
||||
* OpenSSL library under certain conditions as described in each
|
||||
* individual source file, and distribute linked combinations
|
||||
* including the two.
|
||||
* You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than OpenSSL. If you modify
|
||||
* file(s) with this exception, you may extend this exception to your
|
||||
* version of the file(s), but you are not obligated to do so. If you
|
||||
* do not wish to do so, delete this exception statement from your
|
||||
* version. If you delete this exception statement from all source
|
||||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#ifndef _D_REQUEST_GROUP_AWARE_H_
|
||||
#define _D_REQUEST_GROUP_AWARE_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class RequestGroup;
|
||||
|
||||
class RequestGroupAware {
|
||||
protected:
|
||||
RequestGroup* _requestGroup;
|
||||
public:
|
||||
RequestGroupAware(RequestGroup* requestGroup);
|
||||
|
||||
~RequestGroupAware();
|
||||
|
||||
RequestGroup* getRequestGroup() const;
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // _D_REQUEST_GROUP_AWARE_H_
|
|
@ -40,6 +40,7 @@
|
|||
#include "Logger.h"
|
||||
#include "SeedCriteria.h"
|
||||
#include "message.h"
|
||||
#include "RequestGroup.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -49,13 +50,19 @@ SeedCheckCommand::SeedCheckCommand(int cuid,
|
|||
const SharedHandle<BtContext>& btContext,
|
||||
const SeedCriteriaHandle& seedCriteria)
|
||||
:Command(cuid),
|
||||
RequestGroupAware(requestGroup),
|
||||
_requestGroup(requestGroup),
|
||||
e(e),
|
||||
_btContext(btContext),
|
||||
seedCriteria(seedCriteria),
|
||||
checkStarted(false)
|
||||
{
|
||||
setStatusRealtime();
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
SeedCheckCommand::~SeedCheckCommand()
|
||||
{
|
||||
_requestGroup->decreaseNumCommand();
|
||||
}
|
||||
|
||||
bool SeedCheckCommand::execute() {
|
||||
|
|
|
@ -37,20 +37,20 @@
|
|||
|
||||
#include "Command.h"
|
||||
#include "SharedHandle.h"
|
||||
#include "RequestGroupAware.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class RequestGroup;
|
||||
class DownloadEngine;
|
||||
class SeedCriteria;
|
||||
class BtContext;
|
||||
class BtRuntime;
|
||||
class PieceStorage;
|
||||
|
||||
class SeedCheckCommand : public Command,
|
||||
public RequestGroupAware
|
||||
class SeedCheckCommand : public Command
|
||||
{
|
||||
private:
|
||||
RequestGroup* _requestGroup;
|
||||
DownloadEngine* e;
|
||||
SharedHandle<BtContext> _btContext;
|
||||
SharedHandle<PieceStorage> _pieceStorage;
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
const SharedHandle<BtContext>& btContext,
|
||||
const SharedHandle<SeedCriteria>& seedCriteria);
|
||||
|
||||
virtual ~SeedCheckCommand() {}
|
||||
virtual ~SeedCheckCommand();
|
||||
|
||||
virtual bool execute();
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
*/
|
||||
/* copyright --> */
|
||||
#include "SleepCommand.h"
|
||||
#include "RequestGroupAware.h"
|
||||
#include "RequestGroup.h"
|
||||
#include "DownloadEngine.h"
|
||||
|
||||
|
|
|
@ -67,12 +67,17 @@ TrackerWatcherCommand::TrackerWatcherCommand(int32_t cuid,
|
|||
DownloadEngine* e,
|
||||
const BtContextHandle& btContext):
|
||||
Command(cuid),
|
||||
RequestGroupAware(requestGroup),
|
||||
_requestGroup(requestGroup),
|
||||
e(e),
|
||||
_btContext(btContext) {}
|
||||
|
||||
TrackerWatcherCommand::~TrackerWatcherCommand() {}
|
||||
_btContext(btContext)
|
||||
{
|
||||
_requestGroup->increaseNumCommand();
|
||||
}
|
||||
|
||||
TrackerWatcherCommand::~TrackerWatcherCommand()
|
||||
{
|
||||
_requestGroup->decreaseNumCommand();
|
||||
}
|
||||
|
||||
bool TrackerWatcherCommand::execute() {
|
||||
if(_requestGroup->isForceHaltRequested()) {
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include "Command.h"
|
||||
#include "SharedHandle.h"
|
||||
#include "RequestGroupAware.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -49,10 +48,11 @@ class PieceStorage;
|
|||
class BtRuntime;
|
||||
class BtAnnounce;
|
||||
|
||||
class TrackerWatcherCommand : public Command,
|
||||
public RequestGroupAware
|
||||
class TrackerWatcherCommand : public Command
|
||||
{
|
||||
private:
|
||||
RequestGroup* _requestGroup;
|
||||
|
||||
DownloadEngine* e;
|
||||
|
||||
SharedHandle<BtContext> _btContext;
|
||||
|
|
Loading…
Reference in New Issue