summaryrefslogtreecommitdiff
path: root/controller
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2019-07-31 16:41:12 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2019-07-31 16:41:12 -0700
commitbb99ef1351b72260836db29d5863ca1ee6dc0478 (patch)
treebf347ba90abb895129ef78f685f57c118df3c257 /controller
parentb3891e5506985ee28730364b0ef5d2f7857a3ea9 (diff)
downloadinfinitytier-bb99ef1351b72260836db29d5863ca1ee6dc0478.tar.gz
infinitytier-bb99ef1351b72260836db29d5863ca1ee6dc0478.zip
Get rid of online status stuff in FileDB, not necessary at all.
Diffstat (limited to 'controller')
-rw-r--r--controller/FileDB.cpp50
1 files changed, 0 insertions, 50 deletions
diff --git a/controller/FileDB.cpp b/controller/FileDB.cpp
index 7b997c49..cda978b8 100644
--- a/controller/FileDB.cpp
+++ b/controller/FileDB.cpp
@@ -71,54 +71,6 @@ FileDB::FileDB(const Identity &myId,const char *path) :
} catch ( ... ) {}
}
}
-
- _onlineUpdateThread = std::thread([this]() {
- unsigned int cnt = 0;
- while (this->_running) {
- std::this_thread::sleep_for(std::chrono::microseconds(100));
- if ((++cnt % 20) == 0) { // 5 seconds
- std::lock_guard<std::mutex> l(this->_online_l);
- if (!this->_running) return;
- if (this->_onlineChanged) {
- char p[4096],atmp[64];
- for(auto nw=this->_online.begin();nw!=this->_online.end();++nw) {
- OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx-online.json",_networksPath.c_str(),(unsigned long long)nw->first);
- FILE *f = fopen(p,"wb");
- if (f) {
- fprintf(f,"{");
- const char *memberPrefix = "";
- for(auto m=nw->second.begin();m!=nw->second.end();++m) {
- fprintf(f,"%s\"%.10llx\":{" ZT_EOL_S,memberPrefix,(unsigned long long)m->first);
- memberPrefix = ",";
- InetAddress lastAddr;
- const char *timestampPrefix = " ";
- int cnt = 0;
- for(auto ts=m->second.rbegin();ts!=m->second.rend();) {
- if (cnt < 25) {
- if (lastAddr != ts->second) {
- lastAddr = ts->second;
- fprintf(f,"%s\"%lld\":\"%s\"" ZT_EOL_S,timestampPrefix,(long long)ts->first,ts->second.toString(atmp));
- timestampPrefix = ",";
- ++cnt;
- ++ts;
- } else {
- ts = std::map<int64_t,InetAddress>::reverse_iterator(m->second.erase(std::next(ts).base()));
- }
- } else {
- ts = std::map<int64_t,InetAddress>::reverse_iterator(m->second.erase(std::next(ts).base()));
- }
- }
- fprintf(f,"}");
- }
- fprintf(f,"}" ZT_EOL_S);
- fclose(f);
- }
- }
- this->_onlineChanged = false;
- }
- }
- }
- });
}
FileDB::~FileDB()
@@ -195,8 +147,6 @@ void FileDB::eraseNetwork(const uint64_t networkId)
char p[16384];
OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx.json",_networksPath.c_str(),networkId);
OSUtils::rm(p);
- OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx-online.json",_networksPath.c_str(),networkId);
- OSUtils::rm(p);
OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx" ZT_PATH_SEPARATOR_S "member",_networksPath.c_str(),(unsigned long long)networkId);
OSUtils::rmDashRf(p);
_networkChanged(network,nullJson,true);