mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 04:53:44 +02:00
Merge branch 'dev' into cmake
This commit is contained in:
commit
e385b3d377
3 changed files with 11 additions and 52 deletions
|
@ -71,54 +71,6 @@ FileDB::FileDB(const Identity &myId,const char *path) :
|
||||||
} catch ( ... ) {}
|
} 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()
|
FileDB::~FileDB()
|
||||||
|
@ -195,8 +147,6 @@ void FileDB::eraseNetwork(const uint64_t networkId)
|
||||||
char p[16384];
|
char p[16384];
|
||||||
OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx.json",_networksPath.c_str(),networkId);
|
OSUtils::ztsnprintf(p,sizeof(p),"%s" ZT_PATH_SEPARATOR_S "%.16llx.json",_networksPath.c_str(),networkId);
|
||||||
OSUtils::rm(p);
|
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::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);
|
OSUtils::rmDashRf(p);
|
||||||
_networkChanged(network,nullJson,true);
|
_networkChanged(network,nullJson,true);
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
/**
|
/**
|
||||||
* Revision
|
* Revision
|
||||||
*/
|
*/
|
||||||
#define ZEROTIER_ONE_VERSION_REVISION 0
|
#define ZEROTIER_ONE_VERSION_REVISION 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build version
|
* Build version
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
* to force a minor update without an actual version number change. It's
|
* to force a minor update without an actual version number change. It's
|
||||||
* not part of the actual release version number.
|
* not part of the actual release version number.
|
||||||
*/
|
*/
|
||||||
#define ZEROTIER_ONE_VERSION_BUILD 1
|
#define ZEROTIER_ONE_VERSION_BUILD 0
|
||||||
|
|
||||||
#ifndef ZT_BUILD_ARCHITECTURE
|
#ifndef ZT_BUILD_ARCHITECTURE
|
||||||
#define ZT_BUILD_ARCHITECTURE 0
|
#define ZT_BUILD_ARCHITECTURE 0
|
||||||
|
|
9
windows-clean.bat
Normal file
9
windows-clean.bat
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
DEL "ZeroTier One.msi"
|
||||||
|
DEL zt1_update*.exe
|
||||||
|
RMDIR /Q /S windows\Build
|
||||||
|
RMDIR /Q /S windows\copyutil\bin
|
||||||
|
RMDIR /Q /S windows\copyutil\obj
|
||||||
|
RMDIR /Q /S windows\WinUI\bin
|
||||||
|
RMDIR /Q /S windows\WinUI\obj
|
||||||
|
RMDIR /Q /S windows\ZeroTierOne\Release
|
||||||
|
RMDIR /Q /S windows\ZeroTierOne\x64
|
Loading…
Add table
Reference in a new issue