]> git.meshlink.io Git - meshlink/commitdiff
Start sending UDP probes after a channel retransmit event.
authorGuus Sliepen <guus@meshlink.io>
Fri, 28 Aug 2020 21:01:50 +0000 (23:01 +0200)
committerGuus Sliepen <guus@meshlink.io>
Fri, 8 Oct 2021 18:57:24 +0000 (20:57 +0200)
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
src/meshlink.c
src/pmtu.c

index f68cf008472870cdc3d85a6cd86d384e6e87d7d5..0179059d443bcf77dbbd276cd5fbb069f06340d7 100644 (file)
@@ -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);
index f92f00984bb6c8538dacb7a961e2780ee8725e97..95880e31fbd91d70c509be18cc2cf3a1b32a088e 100644 (file)
@@ -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);
        }
 }
 
index 5220a737459f0cd061e844be7fd99b442ee5686f..36152cffec2af6d8d23a61f32d5a8fa7ffa202c9 100644 (file)
@@ -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;