diff --git a/examples/cpp/adhoc.cpp b/examples/cpp/adhoc.cpp index cdad3f6..df37a91 100644 --- a/examples/cpp/adhoc.cpp +++ b/examples/cpp/adhoc.cpp @@ -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); diff --git a/examples/cpp/client.cpp b/examples/cpp/client.cpp index e247094..5c33439 100644 --- a/examples/cpp/client.cpp +++ b/examples/cpp/client.cpp @@ -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); diff --git a/examples/cpp/comprehensive.cpp b/examples/cpp/comprehensive.cpp index 23fe872..9d04442 100644 --- a/examples/cpp/comprehensive.cpp +++ b/examples/cpp/comprehensive.cpp @@ -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); diff --git a/examples/cpp/earthtest.cpp b/examples/cpp/earthtest.cpp index 89ee426..a0275c8 100644 --- a/examples/cpp/earthtest.cpp +++ b/examples/cpp/earthtest.cpp @@ -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); diff --git a/examples/cpp/nonblockingclient.cpp b/examples/cpp/nonblockingclient.cpp index 96d43ba..debead1 100644 --- a/examples/cpp/nonblockingclient.cpp +++ b/examples/cpp/nonblockingclient.cpp @@ -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); diff --git a/examples/cpp/nonblockingserver.cpp b/examples/cpp/nonblockingserver.cpp index 1992db8..0281f09 100644 --- a/examples/cpp/nonblockingserver.cpp +++ b/examples/cpp/nonblockingserver.cpp @@ -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); diff --git a/examples/cpp/server.cpp b/examples/cpp/server.cpp index 3588937..1684ab0 100644 --- a/examples/cpp/server.cpp +++ b/examples/cpp/server.cpp @@ -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); diff --git a/examples/objective-c/adhoc.m b/examples/objective-c/adhoc.m index 46ab811..bdac06d 100644 --- a/examples/objective-c/adhoc.m +++ b/examples/objective-c/adhoc.m @@ -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); diff --git a/include/ZeroTierSockets.h b/include/ZeroTierSockets.h index 8afb08c..d25d00b 100644 --- a/include/ZeroTierSockets.h +++ b/include/ZeroTierSockets.h @@ -871,7 +871,7 @@ ZTS_API int ZTCALL zts_allow_network_caching(uint8_t allowed); ZTS_API int ZTCALL zts_allow_peer_caching(uint8_t allowed); /** - * @brief Enable or disable whether the service will read from a local.conf + * @brief Enable or disable whether the service will read node configuration settings from a local.conf * * @usage Should be called before zts_start() if you intend on changing its state. * diff --git a/src/NodeService.cpp b/src/NodeService.cpp index 7c44686..d867680 100644 --- a/src/NodeService.cpp +++ b/src/NodeService.cpp @@ -229,10 +229,6 @@ public: _ports[0] = 0; _ports[1] = 0; _ports[2] = 0; - - allowNetworkCaching = true; - allowPeerCaching = true; - allowLocalConf = false; } virtual ~NodeServiceImpl()