Renamed DownloadResult::infoHashStr to infoHash and changed its

contents from hex digest to raw byte string.
pull/2/head
Tatsuhiro Tsujikawa 2011-10-13 21:52:08 +09:00
parent 310e58bc62
commit 6404f119e1
3 changed files with 5 additions and 4 deletions

View File

@ -87,7 +87,7 @@ struct DownloadResult
std::string bitfieldStr; std::string bitfieldStr;
std::string infoHashStr; std::string infoHash;
size_t pieceLength; size_t pieceLength;

View File

@ -1188,7 +1188,8 @@ DownloadResultHandle RequestGroup::createDownloadResult() const
} }
#ifdef ENABLE_BITTORRENT #ifdef ENABLE_BITTORRENT
if(downloadContext_->hasAttribute(bittorrent::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 #endif // ENABLE_BITTORRENT
res->pieceLength = downloadContext_->getPieceLength(); res->pieceLength = downloadContext_->getPieceLength();

View File

@ -891,9 +891,9 @@ void gatherStoppedDownload
if(requested_key(keys, KEY_UPLOAD_SPEED)) { if(requested_key(keys, KEY_UPLOAD_SPEED)) {
entryDict->put(KEY_UPLOAD_SPEED, VLB_ZERO); entryDict->put(KEY_UPLOAD_SPEED, VLB_ZERO);
} }
if(!ds->infoHashStr.empty()) { if(!ds->infoHash.empty()) {
if(requested_key(keys, KEY_INFO_HASH)) { 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)) { if(requested_key(keys, KEY_NUM_SEEDERS)) {
entryDict->put(KEY_NUM_SEEDERS, VLB_ZERO); entryDict->put(KEY_NUM_SEEDERS, VLB_ZERO);