mirror of https://github.com/aria2/aria2
2006-06-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Util.cc (difftv): Added a cast to (long long int). * src/TorrentMan.cc (advertisePiece): Use push_front. (getAdvertisedPieceIndexes): A performance improvement was made. * src/Time.h (getTimeInMicros): Added a cast to (long long int). (getTimeInMillis): Added a cast to (long long int).pull/1/head
parent
722b3f8957
commit
003a474357
11
ChangeLog
11
ChangeLog
|
@ -5,7 +5,12 @@
|
||||||
|
|
||||||
* src/Time.cc
|
* src/Time.cc
|
||||||
(isNewer): Use Util::difftv().
|
(isNewer): Use Util::difftv().
|
||||||
|
* src/Util.cc
|
||||||
|
(difftv): Added a cast to (long long int).
|
||||||
|
* src/TorrentMan.cc
|
||||||
|
(advertisePiece): Use push_front.
|
||||||
|
(getAdvertisedPieceIndexes): A performance improvement was made.
|
||||||
|
|
||||||
To fix the bug that sends tracker requests without a sleep interval
|
To fix the bug that sends tracker requests without a sleep interval
|
||||||
when the number of connections is less than 15.
|
when the number of connections is less than 15.
|
||||||
|
|
||||||
|
@ -30,6 +35,10 @@
|
||||||
* src/TorrentMan.cc
|
* src/TorrentMan.cc
|
||||||
(getAdvertisedPieceIndexes): Updated the method signature.
|
(getAdvertisedPieceIndexes): Updated the method signature.
|
||||||
|
|
||||||
|
* src/Time.h
|
||||||
|
(getTimeInMicros): Added a cast to (long long int).
|
||||||
|
(getTimeInMillis): Added a cast to (long long int).
|
||||||
|
|
||||||
* Release 0.5.2
|
* Release 0.5.2
|
||||||
|
|
||||||
2006-06-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2006-06-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
|
@ -53,11 +53,11 @@ public:
|
||||||
bool isZero() const { return tv.tv_sec == 0 && tv.tv_usec == 0; }
|
bool isZero() const { return tv.tv_sec == 0 && tv.tv_usec == 0; }
|
||||||
|
|
||||||
long long int getTimeInMicros() const {
|
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 {
|
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.
|
// Returns this object's time value in seconds.
|
||||||
|
|
|
@ -651,7 +651,7 @@ void TorrentMan::onDownloadComplete() {
|
||||||
|
|
||||||
void TorrentMan::advertisePiece(int cuid, int index) {
|
void TorrentMan::advertisePiece(int cuid, int index) {
|
||||||
HaveEntry entry(cuid, index);
|
HaveEntry entry(cuid, index);
|
||||||
haves.push_back(entry);
|
haves.push_front(entry);
|
||||||
};
|
};
|
||||||
|
|
||||||
PieceIndexes TorrentMan::getAdvertisedPieceIndexes(int myCuid,
|
PieceIndexes TorrentMan::getAdvertisedPieceIndexes(int myCuid,
|
||||||
|
@ -659,9 +659,12 @@ PieceIndexes TorrentMan::getAdvertisedPieceIndexes(int myCuid,
|
||||||
PieceIndexes indexes;
|
PieceIndexes indexes;
|
||||||
for(Haves::const_iterator itr = haves.begin(); itr != haves.end(); itr++) {
|
for(Haves::const_iterator itr = haves.begin(); itr != haves.end(); itr++) {
|
||||||
const Haves::value_type& have = *itr;
|
const Haves::value_type& have = *itr;
|
||||||
if(have.cuid == myCuid || lastCheckTime.isNewer(have.registeredTime)) {
|
if(have.cuid == myCuid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(lastCheckTime.isNewer(have.registeredTime)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
indexes.push_back(have.index);
|
indexes.push_back(have.index);
|
||||||
}
|
}
|
||||||
return indexes;
|
return indexes;
|
||||||
|
|
|
@ -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) {
|
if(tv1.tv_sec < tv2.tv_sec || tv1.tv_sec == tv2.tv_sec && tv1.tv_usec < tv2.tv_usec) {
|
||||||
return 0;
|
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);
|
tv1.tv_usec-tv2.tv_usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue