]> git.meshlink.io Git - meshlink/commitdiff
Fix key renewal being called too often after the first renewal.
authorGuus Sliepen <guus@meshlink.io>
Mon, 30 Mar 2020 06:21:24 +0000 (08:21 +0200)
committerGuus Sliepen <guus@meshlink.io>
Mon, 30 Mar 2020 06:21:24 +0000 (08:21 +0200)
src/net.c
src/net_packet.c

index 020ffd4f75de85855620a169349216b9b6cf8efe..85cbf3d442fd1e60e466ca70351bbddeb1d2a126 100644 (file)
--- 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;
                        }
                }
        }
index 8bc363d229a8f45350a09e3d18a53ad5ca264681..56012e0e36a887c9bc2e45eaebaf13e3484d4272 100644 (file)
@@ -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++) {