diff options
Diffstat (limited to 'src/RequestGroup.cc')
| -rw-r--r-- | src/RequestGroup.cc | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index 4db4f21a..2124164f 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -877,15 +877,32 @@ DownloadResultHandle RequestGroup::createDownloadResult() const { std::deque<std::string> uris; getURIs(uris); + + uint64_t sessionDownloadLength = 0; + +#ifdef ENABLE_BITTORRENT + if(!_peerStorage.isNull()) { + sessionDownloadLength = + _peerStorage->calculateStat().getSessionDownloadLength(); + } else +#endif // ENABLE_BITTORRENT + if(!_segmentMan.isNull()) { + sessionDownloadLength = + _segmentMan->calculateSessionDownloadLength(); + } + return - SharedHandle<DownloadResult>(new DownloadResult(_gid, - getFilePath(), - getTotalLength(), - uris.empty() ? A2STR::NIL:uris.front(), - uris.size(), - downloadFinished()? - DownloadResult::FINISHED : - DownloadResult::NOT_YET)); + SharedHandle<DownloadResult> + (new DownloadResult(_gid, + getFilePath(), + getTotalLength(), + uris.empty() ? A2STR::NIL:uris.front(), + uris.size(), + sessionDownloadLength, + _downloadContext->calculateSessionTime(), + downloadFinished()? + DownloadResult::FINISHED : + DownloadResult::NOT_YET)); } void RequestGroup::registerServerHost(const ServerHostHandle& serverHost) |
