From: Sven M. Hallberg Date: Thu, 6 Nov 2014 17:39:33 +0000 (+0100) Subject: hack to wait for SPTPS to complete before opening a channel X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=86f3ebbac7f61dc44ca48dc67ba24bdb41e7cf4a;p=meshlink hack to wait for SPTPS to complete before opening a channel --- diff --git a/test/channels.c b/test/channels.c index 284a13b7..1958ad76 100644 --- a/test/channels.c +++ b/test/channels.c @@ -5,6 +5,7 @@ #include #include "../src/meshlink.h" +#include "../src/node.h" volatile bool bar_reachable = false; volatile bool bar_responded = false; @@ -153,6 +154,17 @@ int main(int argc, char *argv[]) { return 1; } + // XXX not enough to wait for reachable, must wait for SPTPS to complete + for(int i=0; i < 20; i++) { + sleep(1); + if(((node_t *)bar)->status.validkey) + break; + } + if(!((node_t *)bar)->status.validkey) { + fprintf(stderr, "No key exchange after 20 seconds\n"); + return 1; + } + meshlink_channel_t *channel = meshlink_channel_open(mesh1, bar, 7, foo_receive_cb, NULL, 0); meshlink_set_channel_poll_cb(mesh1, channel, poll_cb);