From 81b12b682649c1b742f20c54449df19e12a5a9eb Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 24 Sep 2014 13:53:03 -0700 Subject: Rename the ubiquitous _r pointer to RuntimeEnvironment to RR just to be a little more consistent about using _ to denote private member variables. --- node/SoftwareUpdater.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'node/SoftwareUpdater.cpp') diff --git a/node/SoftwareUpdater.cpp b/node/SoftwareUpdater.cpp index d3a606fa..1f43a1cd 100644 --- a/node/SoftwareUpdater.cpp +++ b/node/SoftwareUpdater.cpp @@ -79,7 +79,7 @@ SoftwareUpdater::~SoftwareUpdater() void SoftwareUpdater::cleanOldUpdates() { - std::string updatesDir(_r->homePath + ZT_PATH_SEPARATOR_S + "updates.d"); + std::string updatesDir(RR->homePath + ZT_PATH_SEPARATOR_S + "updates.d"); std::map dl(Utils::listDirectory(updatesDir.c_str())); for(std::map::iterator i(dl.begin());i!=dl.end();++i) { if (!i->second) @@ -97,7 +97,7 @@ void SoftwareUpdater::sawRemoteVersion(unsigned int vmaj,unsigned int vmin,unsig if ((now - _lastUpdateAttempt) >= ZT_UPDATE_MIN_INTERVAL) { _lastUpdateAttempt = now; _status = UPDATE_STATUS_GETTING_NFO; - _r->http->GET(ZT_DEFAULTS.updateLatestNfoURL,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionInfo,this); + RR->http->GET(ZT_DEFAULTS.updateLatestNfoURL,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionInfo,this); } } } @@ -109,7 +109,7 @@ void SoftwareUpdater::checkNow() if (_status == UPDATE_STATUS_IDLE) { _lastUpdateAttempt = Utils::now(); _status = UPDATE_STATUS_GETTING_NFO; - _r->http->GET(ZT_DEFAULTS.updateLatestNfoURL,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionInfo,this); + RR->http->GET(ZT_DEFAULTS.updateLatestNfoURL,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionInfo,this); } } @@ -158,7 +158,7 @@ bool SoftwareUpdater::validateUpdate( void SoftwareUpdater::_cbHandleGetLatestVersionInfo(void *arg,int code,const std::string &url,const std::string &body) { SoftwareUpdater *upd = (SoftwareUpdater *)arg; - const RuntimeEnvironment *_r = (const RuntimeEnvironment *)upd->_r; + const RuntimeEnvironment *RR = (const RuntimeEnvironment *)upd->_r; Mutex::Lock _l(upd->_lock); if ((upd->_die)||(upd->_status != UPDATE_STATUS_GETTING_NFO)) { @@ -203,7 +203,7 @@ void SoftwareUpdater::_cbHandleGetLatestVersionInfo(void *arg,int code,const std upd->_signedBy = signedBy; upd->_signature = signature; - _r->http->GET(url,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionBinary,arg); + RR->http->GET(url,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionBinary,arg); } catch ( ... ) { LOG("software update check failed: .nfo file invalid or missing field(s)"); upd->_status = UPDATE_STATUS_IDLE; @@ -213,7 +213,7 @@ void SoftwareUpdater::_cbHandleGetLatestVersionInfo(void *arg,int code,const std void SoftwareUpdater::_cbHandleGetLatestVersionBinary(void *arg,int code,const std::string &url,const std::string &body) { SoftwareUpdater *upd = (SoftwareUpdater *)arg; - const RuntimeEnvironment *_r = (const RuntimeEnvironment *)upd->_r; + const RuntimeEnvironment *RR = (const RuntimeEnvironment *)upd->_r; Mutex::Lock _l(upd->_lock); if (!validateUpdate(body.data(),(unsigned int)body.length(),upd->_signedBy,upd->_signature)) { @@ -228,7 +228,7 @@ void SoftwareUpdater::_cbHandleGetLatestVersionBinary(void *arg,int code,const s upd->_status = UPDATE_STATUS_IDLE; return; } - std::string updatesDir(_r->homePath + ZT_PATH_SEPARATOR_S + "updates.d"); + std::string updatesDir(RR->homePath + ZT_PATH_SEPARATOR_S + "updates.d"); std::string updateFilename(url.substr(lastSlash + 1)); if ((updateFilename.length() < 3)||(updateFilename.find("..") != std::string::npos)) { LOG("software update failed: invalid URL: filename contains invalid characters"); @@ -274,7 +274,7 @@ void SoftwareUpdater::_cbHandleGetLatestVersionBinary(void *arg,int code,const s // caller's responsibility (main.c) to pick this up and do the right // thing. upd->_status = UPDATE_STATUS_IDLE; - _r->node->terminate(Node::NODE_RESTART_FOR_UPGRADE,updatePath.c_str()); + RR->node->terminate(Node::NODE_RESTART_FOR_UPGRADE,updatePath.c_str()); } } // namespace ZeroTier -- cgit v1.2.3