X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnet.c;h=a42d933bef822a375fea4c5b4e823d4f6553f683;hb=3bcd5ec746a5575c0c66f8b34922c038eb363b0a;hp=348c9e343b34a14dae8b04a9b4a2902035d5d6df;hpb=53522b1c11222273c7b41f72b374e759d13b2165;p=meshlink diff --git a/src/net.c b/src/net.c index 348c9e34..a42d933b 100644 --- a/src/net.c +++ b/src/net.c @@ -500,7 +500,7 @@ static void periodic_handler(event_loop_t *loop, void *data) { } } - if(!node_read_public_key(mesh, connect_to)) { + if(!connect_to->status.reachable && !node_read_public_key(mesh, connect_to)) { logger(mesh, MESHLINK_DEBUG, "* skip autoconnect since we don't know this node's public key"); skip = true; } @@ -585,6 +585,10 @@ static void periodic_handler(event_loop_t *loop, void *data) { terminate_connection(mesh, disconnect_from->connection, disconnect_from->connection->status.active); } + // reduce timeout if we don't have enough connections + outgoings + if(cur_connects + mesh->outgoings->count < 3) { + timeout = 1; + } // done!