]> git.meshlink.io Git - meshlink/commitdiff
example manynodes: send test messages only to other nodes and not to ourselfs
authorSaverio Proto <zioproto@gmail.com>
Sat, 9 Aug 2014 10:06:53 +0000 (12:06 +0200)
committerSaverio Proto <zioproto@gmail.com>
Sat, 9 Aug 2014 10:06:53 +0000 (12:06 +0200)
examples/manynodes.c

index 98bd93872b57ed00d6ac9dcc2e35cef4ddb4ed06..e00b80beeec203039fec0a353a65e827a62c2f5a 100644 (file)
@@ -36,11 +36,13 @@ static void testmesh () {
                        } else {
                                printf("%zu known nodes:\n", nnodes);
                                for(int i = 0; i < nnodes; i++) {
-                                       printf(" %s\n", nodes[i]->name);
-                                       if(!meshlink_send(mesh[nindex], nodes[i], "magic", strlen("magic") + 1)) {
+                                       //printf(" %s\n", nodes[i]->name);
+                                       if (nindex != i) {
+                                               if(!meshlink_send(mesh[nindex], nodes[i], "magic", strlen("magic") + 1)) {
                fprintf(stderr, "Could not send message to '%s': %s\n", nodes[i]->name, meshlink_strerror(meshlink_errno));
-       }
-       }
+                                               }
+                                       }
+                               }
 
                        }