mirror of https://github.com/aria2/aria2
2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed BitfieldManFactory class. * src/BitfieldManFactory.cc * src/BitfieldManFactory.h * src/DefaultPieceStorage.cc * src/Makefile.am * src/PeerSessionResource.cc * src/Piece.cc * src/main.cc * test/DefaultPieceStorageTest.ccpull/1/head
parent
b89e306599
commit
91127ed864
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed BitfieldManFactory class.
|
||||
* src/BitfieldManFactory.cc
|
||||
* src/BitfieldManFactory.h
|
||||
* src/DefaultPieceStorage.cc
|
||||
* src/Makefile.am
|
||||
* src/PeerSessionResource.cc
|
||||
* src/Piece.cc
|
||||
* src/main.cc
|
||||
* test/DefaultPieceStorageTest.cc
|
||||
|
||||
2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed unused methods from BitfieldMan class. Moved
|
||||
|
|
|
@ -1,61 +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 "BitfieldManFactory.h"
|
||||
#include "BitfieldMan.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
BitfieldManFactoryHandle BitfieldManFactory::factory;
|
||||
|
||||
BitfieldManFactoryHandle BitfieldManFactory::getFactoryInstance()
|
||||
{
|
||||
if(factory.isNull()) {
|
||||
factory.reset(new BitfieldManFactory());
|
||||
}
|
||||
return factory;
|
||||
}
|
||||
|
||||
BitfieldManFactory::BitfieldManFactory() {}
|
||||
|
||||
BitfieldManFactory::~BitfieldManFactory() {}
|
||||
|
||||
BitfieldMan*
|
||||
BitfieldManFactory::createBitfieldMan(size_t blockLength, uint64_t totalLength)
|
||||
{
|
||||
BitfieldMan* bitfieldMan = new BitfieldMan(blockLength, totalLength);
|
||||
return bitfieldMan;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
|
@ -1,63 +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_BITFIELD_MAN_FACTORY_H_
|
||||
#define _D_BITFIELD_MAN_FACTORY_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class Randomizer;
|
||||
class BitfieldMan;
|
||||
|
||||
class BitfieldManFactory {
|
||||
private:
|
||||
static SharedHandle<BitfieldManFactory> factory;
|
||||
|
||||
BitfieldManFactory();
|
||||
public:
|
||||
~BitfieldManFactory();
|
||||
|
||||
static SharedHandle<BitfieldManFactory> getFactoryInstance();
|
||||
|
||||
BitfieldMan* createBitfieldMan(size_t blockLength, uint64_t totalLength);
|
||||
};
|
||||
|
||||
typedef SharedHandle<BitfieldManFactory> BitfieldManFactoryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // _D_BITFIELD_MAN_FACTORY_H_
|
|
@ -46,7 +46,6 @@
|
|||
#include "DirectDiskAdaptor.h"
|
||||
#include "MultiDiskAdaptor.h"
|
||||
#include "DiskWriter.h"
|
||||
#include "BitfieldManFactory.h"
|
||||
#include "BitfieldMan.h"
|
||||
#include "message.h"
|
||||
#include "DefaultDiskWriterFactory.h"
|
||||
|
@ -65,9 +64,8 @@ namespace aria2 {
|
|||
DefaultPieceStorage::DefaultPieceStorage
|
||||
(const SharedHandle<DownloadContext>& downloadContext, const Option* option):
|
||||
downloadContext(downloadContext),
|
||||
bitfieldMan(BitfieldManFactory::getFactoryInstance()->
|
||||
createBitfieldMan(downloadContext->getPieceLength(),
|
||||
downloadContext->getTotalLength())),
|
||||
bitfieldMan(new BitfieldMan(downloadContext->getPieceLength(),
|
||||
downloadContext->getTotalLength())),
|
||||
_diskWriterFactory(new DefaultDiskWriterFactory()),
|
||||
endGamePieceNum(END_GAME_PIECE_NUM),
|
||||
logger(LogFactory::getInstance()),
|
||||
|
|
|
@ -60,7 +60,6 @@ SRCS = Socket.h\
|
|||
SpeedCalc.cc SpeedCalc.h\
|
||||
PeerStat.h\
|
||||
BitfieldMan.cc BitfieldMan.h\
|
||||
BitfieldManFactory.cc BitfieldManFactory.h\
|
||||
Randomizer.h\
|
||||
SimpleRandomizer.cc SimpleRandomizer.h\
|
||||
HttpResponse.cc HttpResponse.h\
|
||||
|
|
|
@ -337,8 +337,7 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
SharedHandle.h HandleRegistry.h FeatureConfig.cc \
|
||||
FeatureConfig.h DownloadEngineFactory.cc \
|
||||
DownloadEngineFactory.h SpeedCalc.cc SpeedCalc.h PeerStat.h \
|
||||
BitfieldMan.cc BitfieldMan.h BitfieldManFactory.cc \
|
||||
BitfieldManFactory.h Randomizer.h SimpleRandomizer.cc \
|
||||
BitfieldMan.cc BitfieldMan.h Randomizer.h SimpleRandomizer.cc \
|
||||
SimpleRandomizer.h HttpResponse.cc HttpResponse.h \
|
||||
HttpRequest.cc HttpRequest.h Range.h \
|
||||
AbstractProxyRequestCommand.cc AbstractProxyRequestCommand.h \
|
||||
|
@ -782,9 +781,8 @@ am__objects_27 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
|||
base32.$(OBJEXT) LogFactory.$(OBJEXT) TimeA2.$(OBJEXT) \
|
||||
FeatureConfig.$(OBJEXT) DownloadEngineFactory.$(OBJEXT) \
|
||||
SpeedCalc.$(OBJEXT) BitfieldMan.$(OBJEXT) \
|
||||
BitfieldManFactory.$(OBJEXT) SimpleRandomizer.$(OBJEXT) \
|
||||
HttpResponse.$(OBJEXT) HttpRequest.$(OBJEXT) \
|
||||
AbstractProxyRequestCommand.$(OBJEXT) \
|
||||
SimpleRandomizer.$(OBJEXT) HttpResponse.$(OBJEXT) \
|
||||
HttpRequest.$(OBJEXT) AbstractProxyRequestCommand.$(OBJEXT) \
|
||||
AbstractProxyResponseCommand.$(OBJEXT) Netrc.$(OBJEXT) \
|
||||
AuthConfig.$(OBJEXT) AbstractAuthResolver.$(OBJEXT) \
|
||||
DefaultAuthResolver.$(OBJEXT) NetrcAuthResolver.$(OBJEXT) \
|
||||
|
@ -1087,8 +1085,7 @@ SRCS = Socket.h SocketCore.cc SocketCore.h BinaryStream.h Command.cc \
|
|||
SharedHandle.h HandleRegistry.h FeatureConfig.cc \
|
||||
FeatureConfig.h DownloadEngineFactory.cc \
|
||||
DownloadEngineFactory.h SpeedCalc.cc SpeedCalc.h PeerStat.h \
|
||||
BitfieldMan.cc BitfieldMan.h BitfieldManFactory.cc \
|
||||
BitfieldManFactory.h Randomizer.h SimpleRandomizer.cc \
|
||||
BitfieldMan.cc BitfieldMan.h Randomizer.h SimpleRandomizer.cc \
|
||||
SimpleRandomizer.h HttpResponse.cc HttpResponse.h \
|
||||
HttpRequest.cc HttpRequest.h Range.h \
|
||||
AbstractProxyRequestCommand.cc AbstractProxyRequestCommand.h \
|
||||
|
@ -1306,7 +1303,6 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BNode.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Base64.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldMan.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldManFactory.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtAllowedFastMessage.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtAnnounce.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtBitfieldMessage.Po@am__quote@
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
||||
#include "BitfieldManFactory.h"
|
||||
#include "BitfieldMan.h"
|
||||
#include "A2STR.h"
|
||||
#include "BtMessageDispatcher.h"
|
||||
|
@ -52,7 +51,7 @@ PeerSessionResource::PeerSessionResource(size_t pieceLength, uint64_t totalLengt
|
|||
_chokingRequired(true),
|
||||
_optUnchoking(false),
|
||||
_snubbing(false),
|
||||
_bitfieldMan(BitfieldManFactory::getFactoryInstance()->createBitfieldMan(pieceLength, totalLength)),
|
||||
_bitfieldMan(new BitfieldMan(pieceLength, totalLength)),
|
||||
_fastExtensionEnabled(false),
|
||||
_extendedMessagingEnabled(false),
|
||||
_dhtEnabled(false),
|
||||
|
|
13
src/Piece.cc
13
src/Piece.cc
|
@ -34,7 +34,6 @@
|
|||
/* copyright --> */
|
||||
#include "Piece.h"
|
||||
#include "util.h"
|
||||
#include "BitfieldManFactory.h"
|
||||
#include "BitfieldMan.h"
|
||||
#include "A2STR.h"
|
||||
#include "util.h"
|
||||
|
@ -51,14 +50,13 @@ Piece::Piece():index(0), length(0), _blockLength(BLOCK_LENGTH), bitfield(0)
|
|||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
{}
|
||||
|
||||
Piece::Piece(size_t index, size_t length, size_t blockLength):index(index), length(length), _blockLength(blockLength)
|
||||
Piece::Piece(size_t index, size_t length, size_t blockLength):
|
||||
index(index), length(length), _blockLength(blockLength),
|
||||
bitfield(new BitfieldMan(_blockLength, length))
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
, _nextBegin(0)
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
{
|
||||
bitfield =
|
||||
BitfieldManFactory::getFactoryInstance()->createBitfieldMan(_blockLength, length);
|
||||
}
|
||||
{}
|
||||
|
||||
Piece::Piece(const Piece& piece) {
|
||||
index = piece.index;
|
||||
|
@ -206,8 +204,7 @@ void Piece::reconfigure(size_t length)
|
|||
{
|
||||
delete bitfield;
|
||||
this->length = length;
|
||||
bitfield =
|
||||
BitfieldManFactory::getFactoryInstance()->createBitfieldMan(_blockLength, length);
|
||||
bitfield = new BitfieldMan(_blockLength, length);
|
||||
}
|
||||
|
||||
void Piece::setBitfield(const unsigned char* bitfield, size_t len)
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "LogFactory.h"
|
||||
#include "Logger.h"
|
||||
#include "util.h"
|
||||
#include "BitfieldManFactory.h"
|
||||
#include "FeatureConfig.h"
|
||||
#include "MultiUrlRequestInfo.h"
|
||||
#include "SimpleRandomizer.h"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "util.h"
|
||||
#include "Exception.h"
|
||||
#include "BitfieldManFactory.h"
|
||||
#include "Piece.h"
|
||||
#include "Peer.h"
|
||||
#include "Option.h"
|
||||
|
|
Loading…
Reference in New Issue