mirror of https://github.com/aria2/aria2
2008-04-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed compilation error without gcrypt/openssl. * src/DownloadCommand.cc * src/DownloadCommand.hpull/1/head
parent
b74e27ff92
commit
0f64c20da8
|
@ -1,3 +1,9 @@
|
||||||
|
2008-04-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Fixed compilation error without gcrypt/openssl.
|
||||||
|
* src/DownloadCommand.cc
|
||||||
|
* src/DownloadCommand.h
|
||||||
|
|
||||||
2008-04-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-04-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Reorganized version information so that it can be displayed in a
|
Reorganized version information so that it can be displayed in a
|
||||||
|
|
|
@ -67,16 +67,13 @@ DownloadCommand::DownloadCommand(int cuid,
|
||||||
RequestGroup* requestGroup,
|
RequestGroup* requestGroup,
|
||||||
DownloadEngine* e,
|
DownloadEngine* e,
|
||||||
const SocketHandle& s):
|
const SocketHandle& s):
|
||||||
AbstractCommand(cuid, req, requestGroup, e, s),
|
AbstractCommand(cuid, req, requestGroup, e, s)
|
||||||
#ifdef ENABLE_MESSAGE_DIGEST
|
|
||||||
_messageDigestContext(0)
|
|
||||||
#endif // ENABLE_MESSAGE_DIGEST
|
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_MESSAGE_DIGEST
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
{
|
{
|
||||||
std::string algo = _requestGroup->getDownloadContext()->getPieceHashAlgo();
|
std::string algo = _requestGroup->getDownloadContext()->getPieceHashAlgo();
|
||||||
if(MessageDigestContext::supports(algo)) {
|
if(MessageDigestContext::supports(algo)) {
|
||||||
_messageDigestContext = new MessageDigestContext();
|
_messageDigestContext.reset(new MessageDigestContext());
|
||||||
_messageDigestContext->trySetAlgo(algo);
|
_messageDigestContext->trySetAlgo(algo);
|
||||||
_messageDigestContext->digestInit();
|
_messageDigestContext->digestInit();
|
||||||
}
|
}
|
||||||
|
@ -93,9 +90,6 @@ DownloadCommand::DownloadCommand(int cuid,
|
||||||
DownloadCommand::~DownloadCommand() {
|
DownloadCommand::~DownloadCommand() {
|
||||||
assert(peerStat.get());
|
assert(peerStat.get());
|
||||||
peerStat->downloadStop();
|
peerStat->downloadStop();
|
||||||
#ifdef ENABLE_MESSAGE_DIGEST
|
|
||||||
delete _messageDigestContext;
|
|
||||||
#endif // ENABLE_MESSAGE_DIGEST
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DownloadCommand::executeInternal() {
|
bool DownloadCommand::executeInternal() {
|
||||||
|
@ -202,12 +196,12 @@ void DownloadCommand::validatePieceHash(const SegmentHandle& segment)
|
||||||
#ifdef ENABLE_MESSAGE_DIGEST
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
std::string expectedPieceHash =
|
std::string expectedPieceHash =
|
||||||
_requestGroup->getDownloadContext()->getPieceHash(segment->getIndex());
|
_requestGroup->getDownloadContext()->getPieceHash(segment->getIndex());
|
||||||
if(_messageDigestContext &&
|
if(!_messageDigestContext.isNull() &&
|
||||||
e->option->get(PREF_REALTIME_CHUNK_CHECKSUM) == V_TRUE &&
|
e->option->get(PREF_REALTIME_CHUNK_CHECKSUM) == V_TRUE &&
|
||||||
!expectedPieceHash.empty()) {
|
!expectedPieceHash.empty()) {
|
||||||
_messageDigestContext->digestReset();
|
_messageDigestContext->digestReset();
|
||||||
std::string actualPieceHash =
|
std::string actualPieceHash =
|
||||||
MessageDigestHelper::digest(_messageDigestContext,
|
MessageDigestHelper::digest(_messageDigestContext.get(),
|
||||||
_requestGroup->getPieceStorage()->getDiskAdaptor(),
|
_requestGroup->getPieceStorage()->getDiskAdaptor(),
|
||||||
segment->getPosition(),
|
segment->getPosition(),
|
||||||
segment->getLength());
|
segment->getLength());
|
||||||
|
|
|
@ -52,7 +52,7 @@ private:
|
||||||
unsigned int lowestDownloadSpeedLimit;
|
unsigned int lowestDownloadSpeedLimit;
|
||||||
SharedHandle<PeerStat> peerStat;
|
SharedHandle<PeerStat> peerStat;
|
||||||
#ifdef ENABLE_MESSAGE_DIGEST
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
MessageDigestContext* _messageDigestContext;
|
SharedHandle<MessageDigestContext> _messageDigestContext;
|
||||||
#endif // ENABLE_MESSAGE_DIGEST
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
|
|
||||||
void validatePieceHash(const SharedHandle<Segment>& segment);
|
void validatePieceHash(const SharedHandle<Segment>& segment);
|
||||||
|
|
Loading…
Reference in New Issue