diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-06-24 17:26:59 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-06-24 17:26:59 +0000 |
| commit | 5b2c2e626bfe0108d2a8adb01cde16540de696b9 (patch) | |
| tree | f1b0c17a1e791701f9414c5a1e853857a34112f1 /src | |
| parent | 87a30ff857d3269c37a7ebb6c4f530ad62fd9e6c (diff) | |
| parent | 003a47435758a976a57c483c37859989105e204e (diff) | |
Tagging 0.5.2 release of aria2release-0.5.2
Diffstat (limited to 'src')
| -rw-r--r-- | src/Time.h | 4 | ||||
| -rw-r--r-- | src/TorrentMan.cc | 7 | ||||
| -rw-r--r-- | src/Util.cc | 2 |
3 files changed, 8 insertions, 5 deletions
@@ -53,11 +53,11 @@ public: bool isZero() const { return tv.tv_sec == 0 && tv.tv_usec == 0; } long long int getTimeInMicros() const { - return tv.tv_sec*1000*1000+tv.tv_usec; + return (long long int)tv.tv_sec*1000*1000+tv.tv_usec; } long long int getTimeInMillis() const { - return tv.tv_sec*1000+tv.tv_usec/1000; + return (long long int)tv.tv_sec*1000+tv.tv_usec/1000; } // Returns this object's time value in seconds. diff --git a/src/TorrentMan.cc b/src/TorrentMan.cc index 1e607dc1..ebdd9f80 100644 --- a/src/TorrentMan.cc +++ b/src/TorrentMan.cc @@ -651,7 +651,7 @@ void TorrentMan::onDownloadComplete() { void TorrentMan::advertisePiece(int cuid, int index) { HaveEntry entry(cuid, index); - haves.push_back(entry); + haves.push_front(entry); }; PieceIndexes TorrentMan::getAdvertisedPieceIndexes(int myCuid, @@ -659,9 +659,12 @@ PieceIndexes TorrentMan::getAdvertisedPieceIndexes(int myCuid, PieceIndexes indexes; for(Haves::const_iterator itr = haves.begin(); itr != haves.end(); itr++) { const Haves::value_type& have = *itr; - if(have.cuid == myCuid || lastCheckTime.isNewer(have.registeredTime)) { + if(have.cuid == myCuid) { continue; } + if(lastCheckTime.isNewer(have.registeredTime)) { + break; + } indexes.push_back(have.index); } return indexes; diff --git a/src/Util.cc b/src/Util.cc index 7bdfcac8..c48dfc3d 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -94,7 +94,7 @@ long long int Util::difftv(struct timeval tv1, struct timeval tv2) { if(tv1.tv_sec < tv2.tv_sec || tv1.tv_sec == tv2.tv_sec && tv1.tv_usec < tv2.tv_usec) { return 0; } - return ((tv1.tv_sec-tv2.tv_sec)*1000000+ + return ((long long int)(tv1.tv_sec-tv2.tv_sec)*1000000+ tv1.tv_usec-tv2.tv_usec); } |
