summaryrefslogtreecommitdiff
path: root/src/DownloadCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-04-20 00:50:22 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-04-20 00:50:22 +0000
commit3505201f3333c937b5b870d70019d400c722a69f (patch)
treedef64ac6be50375e43da5e3e91eb443dd4c171fc /src/DownloadCommand.cc
parent99733a84e2102739ee7c9de08ffae9e9216b6003 (diff)
2008-04-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten SharedHandle. Now copy constructor taking raw pointer has keyword explicit and SharedHandle's default constructor initializes its internal obj to null, old implementation initializes it using obj's default constructor. To assign null, write SharedHandle<T> x(...); x.reset(); TODO: test/SharedHandleTest.cc needs more tests. * src/SharedHandle.h
Diffstat (limited to 'src/DownloadCommand.cc')
-rw-r--r--src/DownloadCommand.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc
index 3e052266..4f86c30f 100644
--- a/src/DownloadCommand.cc
+++ b/src/DownloadCommand.cc
@@ -67,11 +67,9 @@ DownloadCommand::DownloadCommand(int cuid,
DownloadEngine* e,
const SocketHandle& s):
AbstractCommand(cuid, req, requestGroup, e, s),
- peerStat(0),
#ifdef ENABLE_MESSAGE_DIGEST
- _messageDigestContext(0),
+ _messageDigestContext(0)
#endif // ENABLE_MESSAGE_DIGEST
- transferDecoder(0)
{
#ifdef ENABLE_MESSAGE_DIGEST
{
@@ -85,7 +83,7 @@ DownloadCommand::DownloadCommand(int cuid,
#endif // ENABLE_MESSAGE_DIGEST
peerStat = _requestGroup->getSegmentMan()->getPeerStat(cuid);
if(peerStat.isNull()) {
- peerStat = new PeerStat(cuid);
+ peerStat.reset(new PeerStat(cuid));
_requestGroup->getSegmentMan()->registerPeerStat(peerStat);
}
peerStat->downloadStart();
@@ -175,7 +173,7 @@ void DownloadCommand::checkLowestDownloadSpeed() const
bool DownloadCommand::prepareForNextSegment() {
if(_requestGroup->downloadFinished()) {
#ifdef ENABLE_MESSAGE_DIGEST
- CheckIntegrityEntryHandle entry = new ChecksumCheckIntegrityEntry(_requestGroup);
+ CheckIntegrityEntryHandle entry(new ChecksumCheckIntegrityEntry(_requestGroup));
if(entry->isValidationReady()) {
entry->initValidator();
CheckIntegrityCommand* command =