diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-07-18 14:28:38 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-07-18 14:28:38 -0700 |
commit | ae65eb5105d66859ff4c8b4aefdf4993fe6bc35c (patch) | |
tree | 1ffdfc360c23e1b40277f90c532992bbc4eb0f62 /controller | |
parent | 727ccb112543f3c44da3d094fa755e3a5d25cc3e (diff) | |
download | infinitytier-ae65eb5105d66859ff4c8b4aefdf4993fe6bc35c.tar.gz infinitytier-ae65eb5105d66859ff4c8b4aefdf4993fe6bc35c.zip |
Cleanup and replace trace field names with sane ones because usability > a few bytes.
Diffstat (limited to 'controller')
-rw-r--r-- | controller/EmbeddedNetworkController.cpp | 9 | ||||
-rw-r--r-- | controller/JSONDB.cpp | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp index 07ab5168..2caec827 100644 --- a/controller/EmbeddedNetworkController.cpp +++ b/controller/EmbeddedNetworkController.cpp @@ -1087,6 +1087,9 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpDELETE( void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt) { + static volatile unsigned long idCounter = 0; + + char id[128]; try { std::vector<uint64_t> nw4m(_db.networksForMember(rt.origin)); @@ -1135,6 +1138,10 @@ void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt) } } + OSUtils::ztsnprintf(id,sizeof(id),"%.10llx-%.10llx-%.16llx-%.8lx",_signingId.address().toInt(),rt.origin,OSUtils::now(),++idCounter); + d["id"] = id; + d["objtype"] = "trace"; + bool accept = true; /* for(std::vector<uint64_t>::const_iterator nwid(nw4m.begin());nwid!=nw4m.end();++nwid) { @@ -1159,7 +1166,7 @@ void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt) */ if (accept) { char p[128]; - OSUtils::ztsnprintf(p,sizeof(p),"trace/%.10llx-%.10llx-%.16llx",_signingId.address().toInt(),rt.origin,OSUtils::now()); + OSUtils::ztsnprintf(p,sizeof(p),"trace/%s",id); _db.writeRaw(p,OSUtils::jsonDump(d)); } } catch ( ... ) { diff --git a/controller/JSONDB.cpp b/controller/JSONDB.cpp index 7f92d6ee..ad9ba248 100644 --- a/controller/JSONDB.cpp +++ b/controller/JSONDB.cpp @@ -334,6 +334,7 @@ void JSONDB::threadMain() rawInputBuf.clear(); } } + continue; // we only want to do the stuff below this every few dozen ms or so, so pause again } } #else |