From 79d712373a1beb6bca71af56b1540834d467dce1 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 27 Oct 2019 14:02:47 +0100 Subject: [PATCH] Restart UDP SPTPS when a node reconnects with a new session ID. If a node restarts, but its old connection was not considered closed yet, the graph algorithm never saw it go down. We still want to ensure we restart UDP SPTPS in this case. --- src/graph.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/graph.c b/src/graph.c index 9955ea41..d40087d8 100644 --- a/src/graph.c +++ b/src/graph.c @@ -144,6 +144,23 @@ static void check_reachability(meshlink_handle_t *mesh) { if(n->utcp) { utcp_abort_all_connections(n->utcp); } + + if(n->status.visited == n->status.reachable) { + /* This session replaces the previous one without changing reachability status. + * We still need to reset the UDP SPTPS state. + */ + n->status.validkey = false; + sptps_stop(&n->sptps); + n->status.waitingforkey = false; + n->last_req_key = 0; + + n->status.udp_confirmed = false; + n->maxmtu = MTU; + n->minmtu = 0; + n->mtuprobes = 0; + + timeout_del(&mesh->loop, &n->mtutimeout); + } } if(n->status.visited != n->status.reachable) { -- 2.39.5