meshlink_set_dev_class_fast_retry_period(handle, devclass, fast_retry_period);
}
+ /// Set device class maximum timeout
+ /** This sets the maximum timeout for outgoing connection retries for a given device class.
+ *
+ * @param devclass The device class to update
+ * @param maxtimeout The maximum timeout between reconnection attempts, in seconds. The default is 900.
+ */
+ void set_dev_class_maxtimeout(dev_class_t devclass, int maxtimeout) {
+ meshlink_set_dev_class_maxtimeout(handle, devclass, maxtimeout);
+ }
+
/// Set which order invitations are committed
/** This determines in which order configuration files are written to disk during an invitation.
* By default, the invitee saves the configuration to disk first, then the inviter.
/// Device class traits
static const dev_class_traits_t default_class_traits[DEV_CLASS_COUNT] = {
- { .pingtimeout = 5, .pinginterval = 60, .min_connects = 3, .max_connects = 10000, .edge_weight = 1 }, // DEV_CLASS_BACKBONE
- { .pingtimeout = 5, .pinginterval = 60, .min_connects = 3, .max_connects = 100, .edge_weight = 3 }, // DEV_CLASS_STATIONARY
- { .pingtimeout = 5, .pinginterval = 60, .min_connects = 3, .max_connects = 3, .edge_weight = 6 }, // DEV_CLASS_PORTABLE
- { .pingtimeout = 5, .pinginterval = 60, .min_connects = 1, .max_connects = 1, .edge_weight = 9 }, // DEV_CLASS_UNKNOWN
+ { .pingtimeout = 5, .pinginterval = 60, .maxtimeout = 900, .min_connects = 3, .max_connects = 10000, .edge_weight = 1 }, // DEV_CLASS_BACKBONE
+ { .pingtimeout = 5, .pinginterval = 60, .maxtimeout = 900, .min_connects = 3, .max_connects = 100, .edge_weight = 3 }, // DEV_CLASS_STATIONARY
+ { .pingtimeout = 5, .pinginterval = 60, .maxtimeout = 900, .min_connects = 3, .max_connects = 3, .edge_weight = 6 }, // DEV_CLASS_PORTABLE
+ { .pingtimeout = 5, .pinginterval = 60, .maxtimeout = 900, .min_connects = 1, .max_connects = 1, .edge_weight = 9 }, // DEV_CLASS_UNKNOWN
};
meshlink_handle_t *meshlink_open(const char *confbase, const char *name, const char *appname, dev_class_t devclass) {
assert(pthread_mutex_unlock(&mesh->mutex) == 0);
}
+void meshlink_set_dev_class_maxtimeout(struct meshlink_handle *mesh, dev_class_t devclass, int maxtimeout) {
+ if(!mesh || devclass < 0 || devclass >= DEV_CLASS_COUNT) {
+ meshlink_errno = EINVAL;
+ return;
+ }
+
+ if(maxtimeout < 0) {
+ meshlink_errno = EINVAL;
+ return;
+ }
+
+ assert(pthread_mutex_lock(&mesh->mutex) == 0);
+ mesh->dev_class_traits[devclass].maxtimeout = maxtimeout;
+ assert(pthread_mutex_unlock(&mesh->mutex) == 0);
+}
+
extern void meshlink_set_inviter_commits_first(struct meshlink_handle *mesh, bool inviter_commits_first) {
if(!mesh) {
meshlink_errno = EINVAL;
*/
void meshlink_set_dev_class_fast_retry_period(struct meshlink_handle *mesh, dev_class_t devclass, int fast_retry_period);
+/// Set device class maximum timeout
+/** This sets the maximum timeout for outgoing connection retries for a given device class.
+ *
+ * \memberof meshlink_handle
+ * @param mesh A handle which represents an instance of MeshLink.
+ * @param devclass The device class to update
+ * @param maxtimeout The maximum timeout between reconnection attempts, in seconds. The default is 900.
+ */
+void meshlink_set_dev_class_maxtimeout(struct meshlink_handle *mesh, dev_class_t devclass, int maxtimeout);
+
/// Set which order invitations are committed
/** This determines in which order configuration files are written to disk during an invitation.
* By default, the invitee saves the configuration to disk first, then the inviter.