mirror of https://github.com/aria2/aria2
2008-01-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Use BencodeVisitor and MessageDigestHelper instead of ShaVisitor. ShaVisitor is now deprecated and slated to be removed. * src/DefaultBtContext.ccpull/1/head
parent
160d5a8614
commit
a548f956fe
|
@ -1,3 +1,9 @@
|
|||
2008-01-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Use BencodeVisitor and MessageDigestHelper instead of ShaVisitor.
|
||||
ShaVisitor is now deprecated and slated to be removed.
|
||||
* src/DefaultBtContext.cc
|
||||
|
||||
2008-01-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Externalize message to message.h
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "List.h"
|
||||
#include "Data.h"
|
||||
#include "DlAbortEx.h"
|
||||
#include "ShaVisitor.h"
|
||||
#include "BencodeVisitor.h"
|
||||
#include "Util.h"
|
||||
#include "MessageDigestHelper.h"
|
||||
#include "a2netcompat.h"
|
||||
|
@ -254,10 +254,11 @@ void DefaultBtContext::processRootDictionary(const Dictionary* rootDic, const st
|
|||
throw new DlAbortEx(MSG_SOMETHING_MISSING_IN_TORRENT, "info directory");
|
||||
}
|
||||
// retrieve infoHash
|
||||
ShaVisitor v;
|
||||
BencodeVisitor v;
|
||||
infoDic->accept(&v);
|
||||
int len;
|
||||
v.getHash(infoHash, len);
|
||||
MessageDigestHelper::digest(infoHash, INFO_HASH_LENGTH, "sha1",
|
||||
v.getBencodedData().c_str(),
|
||||
v.getBencodedData().size());
|
||||
infoHashString = Util::toHex(infoHash, INFO_HASH_LENGTH);
|
||||
// calculate the number of pieces
|
||||
const Data* pieceHashData = dynamic_cast<const Data*>(infoDic->get("pieces"));
|
||||
|
|
Loading…
Reference in New Issue