- snprintf(nodename, sizeof nodename, "%snode%d", namesprefix,i);
- snprintf(filename, sizeof filename, "%s/%s", basebase, nodename);
- bool itsnew = access(filename, R_OK);
- mesh[i] = meshlink_open(filename, nodename, "manynodes", i%_DEV_CLASS_MAX);
- meshlink_set_log_cb(mesh[i], MESHLINK_WARNING, log_message);
+ snprintf(nodename, sizeof(nodename), "%snode%d", namesprefix, i);
+ snprintf(filename, sizeof(filename), "%s/%s", basebase, nodename);
+
+ if(n / (i + 1) > n / 4) {
+ mesh[i] = meshlink_open(filename, nodename, "manynodes", DEV_CLASS_BACKBONE);
+ } else {
+ mesh[i] = meshlink_open(filename, nodename, "manynodes", DEV_CLASS_PORTABLE);
+ }
+
+ meshlink_set_log_cb(mesh[i], MESHLINK_DEBUG, log_message);
+