diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-06-29 15:18:21 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-06-29 15:18:21 +0000 |
| commit | c4d79d7160569bef82c4a67b267d78289b91e449 (patch) | |
| tree | 23d390e759271fa4a55b677d09ff0e23b0111a7d /src/DownloadCommand.cc | |
| parent | e82f870fdc3c1a7fc2c0b66a9f623a5386ece3d6 (diff) | |
2009-06-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten PeerStat handling. In the previous implementation,
faster command tries to find slower command. In this new
implementation, slower command tries to find faster command.
PeerStat is now created in each HTTP/FTP request to get download
rate correctly. If the download range is small, the download rate
tends to small and this will occur at the later stage of download.
* src/AbstractCommand.cc
* src/DownloadCommand.cc
* src/FileEntry.cc
* src/FileEntry.h
* src/Request.cc
* src/Request.h
* src/RequestGroup.h
* src/RequestGroupMan.cc
* src/SegmentMan.cc
* src/SegmentMan.h
* test/SegmentManTest.cc
Diffstat (limited to 'src/DownloadCommand.cc')
| -rw-r--r-- | src/DownloadCommand.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc index 48783817..8033a224 100644 --- a/src/DownloadCommand.cc +++ b/src/DownloadCommand.cc @@ -89,9 +89,9 @@ DownloadCommand::DownloadCommand(int cuid, } } #endif // ENABLE_MESSAGE_DIGEST - peerStat = _requestGroup->getSegmentMan()->getPeerStat(cuid); + peerStat = req->getPeerStat(); if(peerStat.isNull()) { - peerStat.reset(new PeerStat(cuid, req->getHost(), req->getProtocol())); + peerStat = req->initPeerStat(); _requestGroup->getSegmentMan()->registerPeerStat(peerStat); } peerStat->downloadStart(); @@ -100,6 +100,7 @@ DownloadCommand::DownloadCommand(int cuid, DownloadCommand::~DownloadCommand() { assert(peerStat.get()); peerStat->downloadStop(); + req->purgePeerStat(); } bool DownloadCommand::executeInternal() { |
