From: Guus Sliepen Date: Mon, 30 Mar 2020 06:21:24 +0000 (+0200) Subject: Fix key renewal being called too often after the first renewal. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=af87825c8c8479c576af390adae502b2e5bf6e5f;p=meshlink Fix key renewal being called too often after the first renewal. --- diff --git a/src/net.c b/src/net.c index 020ffd4f..85cbf3d4 100644 --- a/src/net.c +++ b/src/net.c @@ -626,6 +626,8 @@ static void periodic_handler(event_loop_t *loop, void *data) { sptps_stop(&n->sptps); n->status.waitingforkey = false; n->last_req_key = 0; + } else { + n->last_req_key = mesh->loop.now.tv_sec; } } } diff --git a/src/net_packet.c b/src/net_packet.c index 8bc363d2..56012e0e 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -334,6 +334,7 @@ static void choose_udp_address(meshlink_handle_t *mesh, const node_t *n, const s } check_socket: + /* Make sure we have a suitable socket for the chosen address */ if(mesh->listen_socket[*sock].sa.sa.sa_family != (*sa)->sa.sa_family) { for(int i = 0; i < mesh->listen_sockets; i++) {