for(int nindex = 0; nindex < n; nindex++) {
nodes = meshlink_get_all_nodes(mesh[nindex], nodes, &nnodes);
for(int nindex = 0; nindex < n; nindex++) {
nodes = meshlink_get_all_nodes(mesh[nindex], nodes, &nnodes);
- if(!meshlink_send(mesh[nindex], nodes[i], "magic", strlen("magic") + 1))
+ 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));
fprintf(stderr, "Could not send message to '%s': %s\n", nodes[i]->name, meshlink_strerror(meshlink_errno));
struct stat ps;
int psr = stat(path, &ps);
if(psr == 0 || errno != ENOENT) {
struct stat ps;
int psr = stat(path, &ps);
if(psr == 0 || errno != ENOENT) {
setitimer(ITIMER_REAL, &zero_timer, NULL);
exportmeshgraph_started = false;
setitimer(ITIMER_REAL, &zero_timer, NULL);
exportmeshgraph_started = false;
static void parse_command(char *buf) {
char *arg = strchr(buf, ' ');
static void parse_command(char *buf) {
char *arg = strchr(buf, ' ');
if(!invitation) {
fprintf(stderr, "Could not invite '%s': %s\n", arg, meshlink_strerror(meshlink_errno));
return;
if(!invitation) {
fprintf(stderr, "Could not invite '%s': %s\n", arg, meshlink_strerror(meshlink_errno));
return;
if(!meshlink_start(mesh[nodeindex])) {
fprintf(stderr, "Could not restart MeshLink: %s\n", meshlink_strerror(meshlink_errno));
exit(1);
if(!meshlink_start(mesh[nodeindex])) {
fprintf(stderr, "Could not restart MeshLink: %s\n", meshlink_strerror(meshlink_errno));
exit(1);
} else if(!strcasecmp(buf, "who")) {
if(!arg) {
nodes = meshlink_get_all_nodes(mesh[nodeindex], nodes, &nnodes);
} else if(!strcasecmp(buf, "who")) {
if(!arg) {
nodes = meshlink_get_all_nodes(mesh[nodeindex], nodes, &nnodes);
printf("Node %s found, pmtu %zd\n", arg, meshlink_get_pmtu(mesh[nodeindex], node));
printf("Node %s found, pmtu %zd\n", arg, meshlink_get_pmtu(mesh[nodeindex], node));
- else if(!strcasecmp(buf, "ege"))
- exportmeshgraph_end(NULL);
- else if(!strcasecmp(buf, "test"))
+ } else if(!strcasecmp(buf, "ege")) {
+ exportmeshgraph_end();
+ } else if(!strcasecmp(buf, "test")) {
"/stop Call meshlink_stop, use /select first to select which node to stop\n"
"/quit Exit this program.\n"
);
"/stop Call meshlink_stop, use /select first to select which node to stop\n"
"/quit Exit this program.\n"
);
if(n < 1) {
fprintf(stderr, "Usage: %s [number of local nodes] [confbase] [prefixnodenames] [graphexport timeout]\n", argv[0]);
return 1;
}
if(n < 1) {
fprintf(stderr, "Usage: %s [number of local nodes] [confbase] [prefixnodenames] [graphexport timeout]\n", argv[0]);
return 1;
}
for(int i = 0; i < n; i++) {
snprintf(nodename, sizeof(nodename), "%snode%d", namesprefix, i);
snprintf(filename, sizeof(filename), "%s/%s", basebase, nodename);
for(int i = 0; i < n; i++) {
snprintf(nodename, sizeof(nodename), "%snode%d", namesprefix, i);
snprintf(filename, sizeof(filename), "%s/%s", basebase, nodename);
mesh[i] = meshlink_open(filename, nodename, "manynodes", DEV_CLASS_BACKBONE);
mesh[i] = meshlink_open(filename, nodename, "manynodes", DEV_CLASS_BACKBONE);
mesh[i] = meshlink_open(filename, nodename, "manynodes", DEV_CLASS_PORTABLE);
mesh[i] = meshlink_open(filename, nodename, "manynodes", DEV_CLASS_PORTABLE);
if(!mesh[i]) {
fprintf(stderr, "errno is: %d\n", meshlink_errno);
fprintf(stderr, "Could not open %s: %s\n", filename, meshlink_strerror(meshlink_errno));
if(!mesh[i]) {
fprintf(stderr, "errno is: %d\n", meshlink_errno);
fprintf(stderr, "Could not open %s: %s\n", filename, meshlink_strerror(meshlink_errno));
fprintf(stderr, "Could not start node %d: %s\n", i, meshlink_strerror(meshlink_errno));
fprintf(stderr, "Could not start node %d: %s\n", i, meshlink_strerror(meshlink_errno));