summaryrefslogtreecommitdiff
path: root/src/FileEntry.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-12 12:48:48 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-12 12:48:48 +0000
commit93e5dbed325f29c1bf867a2847d3b839d545cfb2 (patch)
treef657b55b41a05cf364403a36edf9d0921f426e7d /src/FileEntry.cc
parentf6f5a7e5eeec4f14418fec5a7be1bbe57a7ea7e1 (diff)
2010-11-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed SharedHandle::isNull(). Instead we added operator* and operator unspecified_bool_type. Removed use of WeakHandle and replaced with raw pointer.
Diffstat (limited to 'src/FileEntry.cc')
-rw-r--r--src/FileEntry.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/FileEntry.cc b/src/FileEntry.cc
index bd26a1be..cf09a054 100644
--- a/src/FileEntry.cc
+++ b/src/FileEntry.cc
@@ -160,7 +160,7 @@ FileEntry::getRequest
}
}
uris_.insert(uris_.begin(), pending.begin(), pending.end());
- if(g == 0 && uriReuse && req.isNull() && uris_.size() == pending.size()) {
+ if(g == 0 && uriReuse && !req && uris_.size() == pending.size()) {
// Reuse URIs other than ones in pending
reuseUri(ignoreHost);
} else {
@@ -187,12 +187,12 @@ FileEntry::findFasterRequest(const SharedHandle<Request>& base)
return SharedHandle<Request>();
}
const SharedHandle<PeerStat>& fastest = requestPool_.front()->getPeerStat();
- if(fastest.isNull()) {
+ if(!fastest) {
return SharedHandle<Request>();
}
const SharedHandle<PeerStat>& basestat = base->getPeerStat();
// TODO hard coded value. See PREF_STARTUP_IDLE_TIME
- if(basestat.isNull() ||
+ if(!basestat ||
(basestat->getDownloadStartTime().
difference(global::wallclock) >= startupIdleTime &&
fastest->getAvgDownloadSpeed()*0.8 > basestat->calculateDownloadSpeed())){
@@ -212,10 +212,10 @@ public:
bool operator()(const SharedHandle<Request>& lhs,
const SharedHandle<Request>& rhs) const
{
- if(lhs->getPeerStat().isNull()) {
+ if(!lhs->getPeerStat()) {
return false;
}
- if(rhs->getPeerStat().isNull()) {
+ if(!rhs->getPeerStat()) {
return true;
}
return
@@ -227,7 +227,7 @@ public:
void FileEntry::storePool(const SharedHandle<Request>& request)
{
const SharedHandle<PeerStat>& peerStat = request->getPeerStat();
- if(!peerStat.isNull()) {
+ if(peerStat) {
// We need to calculate average download speed here in order to
// store Request in the right position in the pool.
peerStat->calculateAvgDownloadSpeed();