Fix zts_allow_*_caching() bug that prevents user from properly setting value before node startup

This commit is contained in:
Joseph Henry
2020-10-21 14:26:29 -07:00
parent af26d56097
commit b021e82078
10 changed files with 55 additions and 32 deletions

View File

@@ -226,7 +226,12 @@ int main(int argc, char **argv)
uint64_t adhoc_nwid = zts_generate_adhoc_nwid_from_range(adhocStartPort, adhocEndPort);
int err = ZTS_ERR_OK;
zts_allow_network_caching(false);
// If disabled: (network) details will NOT be written to or read from (networks.d/). It may take slightly longer to start the node
zts_allow_network_caching(1);
// If disabled: (peer) details will NOT be written to or read from (peers.d/). It may take slightly longer to contact a remote peer
zts_allow_peer_caching(1);
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);

View File

@@ -227,6 +227,13 @@ int main(int argc, char **argv)
int err = ZTS_ERR_OK;
// If disabled: (network) details will NOT be written to or read from (networks.d/). It may take slightly longer to start the node
zts_allow_network_caching(1);
// If disabled: (peer) details will NOT be written to or read from (peers.d/). It may take slightly longer to contact a remote peer
zts_allow_peer_caching(1);
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);

View File

@@ -384,16 +384,15 @@ int main(int argc, char **argv)
// Bring up ZeroTier service and join network
// Enable/Disable caching of network details in networks.d
// (read function documentation before disabling!)
// zts_allow_network_caching(0)
// Enable/Disable caching of peer details in peers.d
// (read function documentation before disabling!)
// zts_allow_network_caching(1)
int err = ZTS_ERR_OK;
// If disabled: (network) details will NOT be written to or read from (networks.d/). It may take slightly longer to start the node
zts_allow_network_caching(1);
// If disabled: (peer) details will NOT be written to or read from (peers.d/). It may take slightly longer to contact a remote peer
zts_allow_peer_caching(1);
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(configPath.c_str(), &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);

View File

@@ -181,7 +181,13 @@ int main(int argc, char **argv)
int ztServicePort = atoi(argv[2]); // Port ZT uses to send encrypted UDP packets to peers (try something like 9994)
int err = ZTS_ERR_OK;
zts_allow_network_caching(false);
// If disabled: (network) details will NOT be written to or read from (networks.d/). It may take slightly longer to start the node
zts_allow_network_caching(1);
// If disabled: (peer) details will NOT be written to or read from (peers.d/). It may take slightly longer to contact a remote peer
zts_allow_peer_caching(1);
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);

View File

@@ -228,16 +228,15 @@ int main(int argc, char **argv)
// Bring up ZeroTier service and join network
// Enable/Disable caching of network details in networks.d
// (read function documentation before disabling!)
// zts_allow_network_caching(0)
// Enable/Disable caching of peer details in peers.d
// (read function documentation before disabling!)
// zts_allow_network_caching(1)
int err = ZTS_ERR_OK;
// If disabled: (network) details will NOT be written to or read from (networks.d/). It may take slightly longer to start the node
zts_allow_network_caching(1);
// If disabled: (peer) details will NOT be written to or read from (peers.d/). It may take slightly longer to contact a remote peer
zts_allow_peer_caching(1);
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);

View File

@@ -226,17 +226,16 @@ int main(int argc, char **argv)
// Bring up ZeroTier service and join network
// Enable/Disable caching of network details in networks.d
// (read function documentation before disabling!)
// zts_allow_network_caching(0)
// Enable/Disable caching of peer details in peers.d
// (read function documentation before disabling!)
// zts_allow_network_caching(1)
int fd, accfd;
int err = ZTS_ERR_OK;
// If disabled: (network) details will NOT be written to or read from (networks.d/). It may take slightly longer to start the node
zts_allow_network_caching(1);
// If disabled: (peer) details will NOT be written to or read from (peers.d/). It may take slightly longer to contact a remote peer
zts_allow_peer_caching(1);
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);

View File

@@ -227,6 +227,13 @@ int main(int argc, char **argv)
int fd, accfd;
int err = ZTS_ERR_OK;
// If disabled: (network) details will NOT be written to or read from (networks.d/). It may take slightly longer to start the node
zts_allow_network_caching(1);
// If disabled: (peer) details will NOT be written to or read from (peers.d/). It may take slightly longer to contact a remote peer
zts_allow_peer_caching(1);
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);

View File

@@ -206,7 +206,12 @@ int main(int argc, char **argv)
uint64_t adhoc_nwid = zts_generate_adhoc_nwid_from_range(adhocStartPort, adhocEndPort);
int err = ZTS_ERR_OK;
zts_allow_network_caching(false);
// If disabled: (network) details will NOT be written to or read from (networks.d/). It may take slightly longer to start the node
zts_allow_network_caching(1);
// If disabled: (peer) details will NOT be written to or read from (peers.d/). It may take slightly longer to contact a remote peer
zts_allow_peer_caching(1);
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
NSLog(@"Unable to start service, error = %d. Exiting.\n", err);