X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fnet_setup.c;h=96be9df37d87b6be2610436cf845e5c1ec32b2cb;hp=45e20d008955046982670547d0ebc8f34c7ae5ec;hb=5f7b734ef1a6a22a537c3ee3b29c8095fa9a803e;hpb=79703f03cde61be1023813486ed3a9521b88f689 diff --git a/src/net_setup.c b/src/net_setup.c index 45e20d00..96be9df3 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -266,6 +266,8 @@ static bool add_listen_address(meshlink_handle_t *mesh, char *address, bool bind return false; } + bool success = false; + for(struct addrinfo *aip = ai; aip; aip = aip->ai_next) { // Ignore duplicate addresses bool found = false; @@ -308,10 +310,11 @@ static bool add_listen_address(meshlink_handle_t *mesh, char *address, bool bind mesh->listen_socket[mesh->listen_sockets].bindto = bindto; memcpy(&mesh->listen_socket[mesh->listen_sockets].sa, aip->ai_addr, aip->ai_addrlen); mesh->listen_sockets++; + success = true; } freeaddrinfo(ai); - return true; + return success; } /* @@ -389,8 +392,8 @@ bool setup_myself(meshlink_handle_t *mesh) { mesh->listen_sockets = 0; if(!add_listen_address(mesh, address, NULL)) { - if(!strcmp(mesh->myport, "0")) { - logger(mesh, MESHLINK_WARNING, "Could not bind to port %s, asking OS to choose one for us", mesh->myport); + if(strcmp(mesh->myport, "0")) { + logger(mesh, MESHLINK_INFO, "Could not bind to port %s, asking OS to choose one for us", mesh->myport); free(mesh->myport); mesh->myport = strdup("0"); if(!mesh->myport)