From dd0d606422b19f89029a3664bf6bc723efceef21 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Thu, 3 Aug 2023 15:47:50 -0700 Subject: [PATCH] Add missing zts_init_set_low_bandwidth_mode --- include/ZeroTierSockets.h | 17 +++++++++++++++++ src/Controls.cpp | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/ZeroTierSockets.h b/include/ZeroTierSockets.h index eb3c6c1..8c74b9f 100644 --- a/include/ZeroTierSockets.h +++ b/include/ZeroTierSockets.h @@ -1315,6 +1315,23 @@ ZTS_API int ZTCALL zts_init_blacklist_if(const char* prefix, unsigned int len); */ ZTS_API int ZTCALL zts_init_set_roots(const void* roots_data, unsigned int len); +/** + * @brief Enable or disable low-bandwidth mode. This is an initialization function that can + * only be called before `zts_node_start()`. + * + * Low-bandwidth mode reduces the ambient traffic that ZeroTier sends + * at the expense of responsiveness to network changes. It does not reduce your + * established connection speeds. It is an adjustment to multiple internal + * timers that results in fewer keepalive probes and network configuration + * requests being sent. This is a good option if your underlying physical network + * doesn't change much. + * + * @param enabled Whether low-bandwidth mode is enabled or not (default: false) + * @return `ZTS_ERR_OK` if successful, `ZTS_ERR_SERVICE` if the node + * experiences a problem. + */ +ZTS_API int ZTCALL zts_init_set_low_bandwidth_mode(int enabled); + /** * @brief Set the port to which the node should bind. This is an initialization function that can * only be called before `zts_node_start()`. diff --git a/src/Controls.cpp b/src/Controls.cpp index 2fd3bc7..8aa0a72 100644 --- a/src/Controls.cpp +++ b/src/Controls.cpp @@ -154,7 +154,7 @@ int zts_init_set_roots(const void* roots_data, unsigned int len) return zts_service->setRoots(roots_data, len); } -int zts_init_set_low_bandwidth_mode(bool enabled) +int zts_init_set_low_bandwidth_mode(int enabled) { ACQUIRE_SERVICE_OFFLINE(); return zts_service->setLowBandwidthMode(enabled);