mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-20 21:33:57 -07:00
Add a bit of useful testing instrumentation to SqliteNetworkController.
This commit is contained in:
parent
85b90f122a
commit
0d386f1c31
5 changed files with 43 additions and 9 deletions
|
@ -662,7 +662,7 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
|
|||
const uint64_t nwid = at<uint64_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_NETWORK_ID);
|
||||
const unsigned int metaDataLength = at<uint16_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT_LEN);
|
||||
const Dictionary metaData((const char *)field(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT,metaDataLength),metaDataLength);
|
||||
const uint64_t haveRevision = ((ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT + metaDataLength + 8) <= size()) ? at<uint64_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT + metaDataLength) : 0ULL;
|
||||
//const uint64_t haveRevision = ((ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT + metaDataLength + 8) <= size()) ? at<uint64_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT + metaDataLength) : 0ULL;
|
||||
|
||||
const unsigned int h = hops();
|
||||
const uint64_t pid = packetId();
|
||||
|
@ -670,7 +670,7 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
|
|||
|
||||
if (RR->localNetworkController) {
|
||||
Dictionary netconf;
|
||||
switch(RR->localNetworkController->doNetworkConfigRequest((h > 0) ? InetAddress() : _remoteAddress,RR->identity,peer->identity(),nwid,metaData,haveRevision,netconf)) {
|
||||
switch(RR->localNetworkController->doNetworkConfigRequest((h > 0) ? InetAddress() : _remoteAddress,RR->identity,peer->identity(),nwid,metaData,netconf)) {
|
||||
|
||||
case NetworkController::NETCONF_QUERY_OK: {
|
||||
const std::string netconfStr(netconf.toString());
|
||||
|
|
|
@ -240,7 +240,7 @@ void Network::requestConfiguration()
|
|||
if (RR->localNetworkController) {
|
||||
SharedPtr<NetworkConfig> nconf(config2());
|
||||
Dictionary newconf;
|
||||
switch(RR->localNetworkController->doNetworkConfigRequest(InetAddress(),RR->identity,RR->identity,_id,Dictionary(),(nconf) ? nconf->revision() : (uint64_t)0,newconf)) {
|
||||
switch(RR->localNetworkController->doNetworkConfigRequest(InetAddress(),RR->identity,RR->identity,_id,Dictionary(),newconf)) {
|
||||
case NetworkController::NETCONF_QUERY_OK:
|
||||
this->setConfiguration(newconf,true);
|
||||
return;
|
||||
|
|
|
@ -75,7 +75,6 @@ public:
|
|||
* @param identity Originating peer ZeroTier identity
|
||||
* @param nwid 64-bit network ID
|
||||
* @param metaData Meta-data bundled with request (empty if none)
|
||||
* @param haveRevision Network revision ID sent by requesting peer or 0 if none
|
||||
* @param result Dictionary to receive resulting signed netconf on success
|
||||
* @return Returns NETCONF_QUERY_OK if result dictionary is valid, or an error code on error
|
||||
*/
|
||||
|
@ -85,7 +84,6 @@ public:
|
|||
const Identity &identity,
|
||||
uint64_t nwid,
|
||||
const Dictionary &metaData,
|
||||
uint64_t haveRevision,
|
||||
Dictionary &result) = 0;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue