From af87825c8c8479c576af390adae502b2e5bf6e5f Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 30 Mar 2020 08:21:24 +0200 Subject: [PATCH] Fix key renewal being called too often after the first renewal. --- src/net.c | 2 ++ src/net_packet.c | 1 + 2 files changed, 3 insertions(+) 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++) { -- 2.39.2