X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fmeshlink.c;h=f87e4de0ec8326d34c07cc5b6b9a196ea10adbda;hp=b9cc18771d22ef5f2c01eba18b38937f3619a4e8;hb=eaea9a2ea3c80478a6aa4e502afaed5b5b6bbfde;hpb=494e5cfca22e2e8fc59a42b01d4a94418d730c2a diff --git a/src/meshlink.c b/src/meshlink.c index b9cc1877..f87e4de0 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -489,7 +489,7 @@ static char *get_my_hostname(meshlink_handle_t *mesh, uint32_t flags) { } } - remove_duplicate_hostnames(hostname, port, 4); + remove_duplicate_hostnames(hostname, port, n); // Resolve the hostnames for(int i = 0; i < n; i++) { @@ -510,8 +510,10 @@ static char *get_my_hostname(meshlink_handle_t *mesh, uint32_t flags) { continue; } - // Remember the address - node_add_recent_address(mesh, mesh->self, (sockaddr_t *)ai_in->ai_addr); + // Remember the address(es) + for(struct addrinfo *aip = ai_in; aip; aip = aip->ai_next) { + node_add_recent_address(mesh, mesh->self, (sockaddr_t *)aip->ai_addr); + } if(flags & MESHLINK_INVITE_NUMERIC) { // We don't need to do any further conversion