From da333d8fb50d4a0440d1a712577a3b09a6c881c5 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 7 Nov 2014 23:53:58 +0000 Subject: [PATCH] test/channel: don't let both sides connect to each other simultaneously. The channel test fails to work reliably when the two threads are started exactly simultaneously and both sides try to connect to each other. Both sides simultaneously initiate a end-to-end SPTPS connection by sending the appropriate req_key request, but upon reception of each others request they reset their own state, causing SPTPS packets from the old and the new state to cross each other. A timeout will occur eventually, causing one side to try to restart the SPTPS connection. Since the timeouts are slightly randomized, this sometimes causes the channel test to work, sometimes not. --- test/channels.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/channels.c b/test/channels.c index f572d1b1..9c3e35b5 100644 --- a/test/channels.c +++ b/test/channels.c @@ -68,7 +68,6 @@ int main(int argc, char *argv[]) { // Import and export both side's data meshlink_add_address(mesh1, "localhost"); - meshlink_add_address(mesh2, "localhost"); char *data = meshlink_export(mesh1); if(!data) { @@ -110,8 +109,6 @@ int main(int argc, char *argv[]) { return 1; } - usleep(123456); - if(!meshlink_start(mesh2)) { fprintf(stderr, "Bar could not start\n"); return 1; @@ -130,8 +127,6 @@ int main(int argc, char *argv[]) { return 1; } - sleep(1); - // Open a channel from foo to bar. meshlink_node_t *bar = meshlink_get_node(mesh1, "bar"); -- 2.39.2