]> git.meshlink.io Git - meshlink/commitdiff
manynodes: add few backbone nodes and many portable nodes to make tests
authorSaverio Proto <zioproto@gmail.com>
Thu, 28 Aug 2014 13:18:00 +0000 (15:18 +0200)
committerSaverio Proto <zioproto@gmail.com>
Thu, 28 Aug 2014 13:35:16 +0000 (15:35 +0200)
examples/manynodes.c

index 16d25ddcce5d6cb94763394a0efd70b44205173b..d158e5b9423176cdb5289efe96765a75c662d78e 100644 (file)
@@ -374,7 +374,12 @@ int main(int argc, char *argv[]) {
                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);
+               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_WARNING, log_message);
                if(!mesh[i]) {
                        fprintf(stderr, "errno is: %d\n", meshlink_errno);