diff --git a/src/DownloadResult.h b/src/DownloadResult.h index 93bd8079..30136f53 100644 --- a/src/DownloadResult.h +++ b/src/DownloadResult.h @@ -87,7 +87,7 @@ struct DownloadResult std::string bitfieldStr; - std::string infoHashStr; + std::string infoHash; size_t pieceLength; diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index 778eea5c..cfeebb01 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -1188,7 +1188,8 @@ DownloadResultHandle RequestGroup::createDownloadResult() const } #ifdef ENABLE_BITTORRENT if(downloadContext_->hasAttribute(bittorrent::BITTORRENT)) { - res->infoHashStr = bittorrent::getInfoHashString(downloadContext_); + const unsigned char* p = bittorrent::getInfoHash(downloadContext_); + res->infoHash = std::string(p, p+INFO_HASH_LENGTH); } #endif // ENABLE_BITTORRENT res->pieceLength = downloadContext_->getPieceLength(); diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc index a3aa6bf5..34347538 100644 --- a/src/RpcMethodImpl.cc +++ b/src/RpcMethodImpl.cc @@ -891,9 +891,9 @@ void gatherStoppedDownload if(requested_key(keys, KEY_UPLOAD_SPEED)) { entryDict->put(KEY_UPLOAD_SPEED, VLB_ZERO); } - if(!ds->infoHashStr.empty()) { + if(!ds->infoHash.empty()) { if(requested_key(keys, KEY_INFO_HASH)) { - entryDict->put(KEY_INFO_HASH, ds->infoHashStr); + entryDict->put(KEY_INFO_HASH, util::toHex(ds->infoHash)); } if(requested_key(keys, KEY_NUM_SEEDERS)) { entryDict->put(KEY_NUM_SEEDERS, VLB_ZERO);