mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-02 19:26:41 +00:00
Add a facility for full flow-through uptime test of controller by Central.
This commit is contained in:
parent
c62141fd98
commit
5268909075
@ -429,6 +429,7 @@ static bool _parseRule(json &r,ZT_VirtualNetworkRule &rule)
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmbeddedNetworkController::EmbeddedNetworkController(Node *node,const char *dbPath) :
|
EmbeddedNetworkController::EmbeddedNetworkController(Node *node,const char *dbPath) :
|
||||||
|
_startTime(OSUtils::now()),
|
||||||
_threadsStarted(false),
|
_threadsStarted(false),
|
||||||
_db(dbPath),
|
_db(dbPath),
|
||||||
_node(node)
|
_node(node)
|
||||||
@ -1067,7 +1068,15 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST(
|
|||||||
|
|
||||||
} // else 404
|
} // else 404
|
||||||
|
|
||||||
} // else 404
|
} else if (path[0] == "dbtest") {
|
||||||
|
|
||||||
|
json testRec;
|
||||||
|
const uint64_t now = OSUtils::now();
|
||||||
|
testRec["clock"] = now;
|
||||||
|
testRec["uptime"] = (now - _startTime);
|
||||||
|
_db.put("dbtest",testRec);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return 404;
|
return 404;
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,6 @@ public:
|
|||||||
throw();
|
throw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void _circuitTestCallback(ZT_Node *node,ZT_CircuitTest *test,const ZT_CircuitTestReport *report);
|
|
||||||
void _request(uint64_t nwid,const InetAddress &fromAddr,uint64_t requestPacketId,const Identity &identity,const Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> &metaData);
|
|
||||||
|
|
||||||
struct _RQEntry
|
struct _RQEntry
|
||||||
{
|
{
|
||||||
uint64_t nwid;
|
uint64_t nwid;
|
||||||
@ -109,11 +106,6 @@ private:
|
|||||||
Identity identity;
|
Identity identity;
|
||||||
Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> metaData;
|
Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> metaData;
|
||||||
};
|
};
|
||||||
BlockingQueue<_RQEntry *> _queue;
|
|
||||||
|
|
||||||
Thread _threads[ZT_EMBEDDEDNETWORKCONTROLLER_BACKGROUND_THREAD_COUNT];
|
|
||||||
bool _threadsStarted;
|
|
||||||
Mutex _threads_m;
|
|
||||||
|
|
||||||
// Gathers a bunch of statistics about members of a network, IP assignments, etc. that we need in various places
|
// Gathers a bunch of statistics about members of a network, IP assignments, etc. that we need in various places
|
||||||
struct _NetworkMemberInfo
|
struct _NetworkMemberInfo
|
||||||
@ -127,12 +119,11 @@ private:
|
|||||||
uint64_t mostRecentDeauthTime;
|
uint64_t mostRecentDeauthTime;
|
||||||
uint64_t nmiTimestamp; // time this NMI structure was computed
|
uint64_t nmiTimestamp; // time this NMI structure was computed
|
||||||
};
|
};
|
||||||
std::map<uint64_t,_NetworkMemberInfo> _nmiCache;
|
|
||||||
Mutex _nmiCache_m;
|
|
||||||
|
|
||||||
|
static void _circuitTestCallback(ZT_Node *node,ZT_CircuitTest *test,const ZT_CircuitTestReport *report);
|
||||||
|
void _request(uint64_t nwid,const InetAddress &fromAddr,uint64_t requestPacketId,const Identity &identity,const Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> &metaData);
|
||||||
void _getNetworkMemberInfo(uint64_t now,uint64_t nwid,_NetworkMemberInfo &nmi);
|
void _getNetworkMemberInfo(uint64_t now,uint64_t nwid,_NetworkMemberInfo &nmi);
|
||||||
inline void _clearNetworkMemberInfoCache(const uint64_t nwid) { Mutex::Lock _l(_nmiCache_m); _nmiCache.erase(nwid); }
|
inline void _clearNetworkMemberInfoCache(const uint64_t nwid) { Mutex::Lock _l(_nmiCache_m); _nmiCache.erase(nwid); }
|
||||||
|
|
||||||
void _pushMemberUpdate(uint64_t now,uint64_t nwid,const nlohmann::json &member);
|
void _pushMemberUpdate(uint64_t now,uint64_t nwid,const nlohmann::json &member);
|
||||||
|
|
||||||
// These init objects with default and static/informational fields
|
// These init objects with default and static/informational fields
|
||||||
@ -188,6 +179,16 @@ private:
|
|||||||
member["clock"] = now;
|
member["clock"] = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint64_t _startTime;
|
||||||
|
|
||||||
|
BlockingQueue<_RQEntry *> _queue;
|
||||||
|
Thread _threads[ZT_EMBEDDEDNETWORKCONTROLLER_BACKGROUND_THREAD_COUNT];
|
||||||
|
bool _threadsStarted;
|
||||||
|
Mutex _threads_m;
|
||||||
|
|
||||||
|
std::map<uint64_t,_NetworkMemberInfo> _nmiCache;
|
||||||
|
Mutex _nmiCache_m;
|
||||||
|
|
||||||
JSONDB _db;
|
JSONDB _db;
|
||||||
Mutex _db_m;
|
Mutex _db_m;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user