diff --git a/lib/sample.c b/lib/sample.c index 596a63230..0645f49b2 100644 --- a/lib/sample.c +++ b/lib/sample.c @@ -22,6 +22,7 @@ #include #include +#include #include "pool.h" #include "sample.h" @@ -151,7 +152,7 @@ int sample_cmp(struct sample *a, struct sample *b, double epsilon, int flags) } if (a->format != b->format) { - printf("format: %#llx != %#llx\n", a->format, b->format); + printf("format: %#" PRIx64 " != %#" PRIx64 "\n", a->format, b->format); return 6; } @@ -166,7 +167,7 @@ int sample_cmp(struct sample *a, struct sample *b, double epsilon, int flags) case SAMPLE_DATA_FORMAT_INT: if (a->data[i].i != b->data[i].i) { - printf("data[%d].i: %lld != %lld\n", i, a->data[i].i, b->data[i].i); + printf("data[%d].i: %" PRId64 " != %" PRId64 "\n", i, a->data[i].i, b->data[i].i); return 5; } break; diff --git a/web/socket/app.js b/web/socket/app.js index 60c5d38cc..9975af45e 100644 --- a/web/socket/app.js +++ b/web/socket/app.js @@ -132,18 +132,23 @@ function apiConnected() function(response) { nodes = response; - console.log("Found " + nodes.length + " nodes:", nodes); + console.log("Found " + nodes.length + " nodes:",); - for (var i = 0; i < nodes.length; i++) - if (nodes[i].name == getParameterByName('node')) - currentNode = nodes[i]; + nodes.forEach(function(node) { + console.log(node); + if (node.type == 'websocket' && node.name == getParameterByName('node')) + currentNode = node; + }); - if (currentNode === undefined) - currentNode = nodes[0]; + if (currentNode === undefined) { + nodes.forEach(function(node) { + if (node.type == 'websocket') + currentNode = node; + }); + } if (currentNode !== undefined) { updateNodeList(); - connection = wsConnect(currentNode); } }