From 93e5dbed325f29c1bf867a2847d3b839d545cfb2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 12 Nov 2010 12:48:48 +0000 Subject: 2010-11-12 Tatsuhiro Tsujikawa Removed SharedHandle::isNull(). Instead we added operator* and operator unspecified_bool_type. Removed use of WeakHandle and replaced with raw pointer. --- src/FileEntry.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/FileEntry.cc') 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& base) return SharedHandle(); } const SharedHandle& fastest = requestPool_.front()->getPeerStat(); - if(fastest.isNull()) { + if(!fastest) { return SharedHandle(); } const SharedHandle& 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& lhs, const SharedHandle& 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) { const SharedHandle& 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(); -- cgit