From 881a652713a6231ad31596b80b674986d0170868 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 28 Aug 2020 23:01:50 +0200 Subject: [PATCH] Start sending UDP probes after a channel retransmit event. Before we started doing PMTU probes after a retransmit event, but with the new UDP probing we need to restart the UDP probes instead, as they will be able to detect failing UDP communication much faster. --- src/graph.c | 2 ++ src/meshlink.c | 9 +++++---- src/pmtu.c | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/graph.c b/src/graph.c index f68cf008..0179059d 100644 --- a/src/graph.c +++ b/src/graph.c @@ -161,6 +161,7 @@ static void check_reachability(meshlink_handle_t *mesh) { n->status.udp_confirmed = false; n->maxmtu = MTU; n->minmtu = 0; + n->udpprobes = 0; n->mtuprobes = 0; } @@ -189,6 +190,7 @@ static void check_reachability(meshlink_handle_t *mesh) { n->status.udp_confirmed = false; n->maxmtu = MTU; n->minmtu = 0; + n->udpprobes = 0; n->mtuprobes = 0; timeout_del(&mesh->loop, &n->udp_ping_timeout); diff --git a/src/meshlink.c b/src/meshlink.c index f92f0098..95880e31 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -30,6 +30,7 @@ #include "node.h" #include "submesh.h" #include "packmsg.h" +#include "pmtu.h" #include "prf.h" #include "protocol.h" #include "route.h" @@ -3631,6 +3632,7 @@ static bool blacklist(meshlink_handle_t *mesh, node_t *n) { n->mtu = 0; n->minmtu = 0; n->maxmtu = MTU; + n->udpprobes = 0; n->mtuprobes = 0; n->status.udp_confirmed = false; @@ -4037,10 +4039,9 @@ static void channel_retransmit(struct utcp_connection *utcp_connection) { node_t *n = utcp_connection->utcp->priv; meshlink_handle_t *mesh = n->mesh; - if(n->mtuprobes == -1 && n->udp_ping_timeout.cb) { - timeout_set(&mesh->loop, &n->udp_ping_timeout, &(struct timespec) { - 0, 0 - }); + if(!n->udpprobes) { + timespec_clear(&n->last_udp_probe_sent); + keepalive(mesh, n, false); } } diff --git a/src/pmtu.c b/src/pmtu.c index 5220a737..36152cff 100644 --- a/src/pmtu.c +++ b/src/pmtu.c @@ -236,7 +236,10 @@ static void try_udp(meshlink_handle_t *mesh, node_t *n) { if(elapsed.tv_sec >= interval) { n->last_udp_probe_sent = mesh->loop.now; send_udp_probe_packet(mesh, n, MIN_PROBE_SIZE); - n->udpprobes--; + + if(n->status.udp_confirmed) { + n->udpprobes--; + } if(!n->status.udp_confirmed && n->prevedge) { n->status.broadcast = true; -- 2.39.5