From 91b76031f6b71a589f24deaf8c373b157e34b4f6 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 20 Nov 2018 16:10:17 +0100 Subject: [PATCH] Fix discovering node addresses from edges. The logic always skipped the first unique address found via edges, and since in most cases there is only one such address, this would skip them altogether. --- src/net_socket.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/net_socket.c b/src/net_socket.c index 6d1d8fb3..d1a5df99 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -481,14 +481,18 @@ static bool get_next_outgoing_address(meshlink_handle_t *mesh, outgoing_t *outgo } if(outgoing->state == OUTGOING_KNOWN) { - if(outgoing->aip || get_recent(mesh, outgoing)) { - if(get_next_ai(mesh, outgoing)) { - return true; - } else { - free_known_addresses(outgoing->ai); - outgoing->ai = NULL; - outgoing->aip = NULL; - } + if(!outgoing->aip) { + get_recent(mesh, outgoing); + } else { + outgoing->aip = outgoing->aip->ai_next; + } + + if(outgoing->aip) { + return true; + } else { + free_known_addresses(outgoing->ai); + outgoing->ai = NULL; + outgoing->aip = NULL; } outgoing->state = OUTGOING_END; -- 2.39.5