]> git.meshlink.io Git - meshlink-tiny/blobdiff - src/net.c
Convert addresses to text using inet_ntop().
[meshlink-tiny] / src / net.c
index c05baf77be7d78ff6f80a9d3cd136276c0850264..d930d1fdd7a2c36e61ee4b11a88f9e32a7a43cf7 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -62,6 +62,8 @@ void terminate_connection(meshlink_handle_t *mesh, connection_t *c, bool report)
                }
 
                c->node->connection = NULL;
+               c->node->status.reachable = false;
+               update_node_status(mesh, c->node);
        }
 
        c->status.active = false;
@@ -99,12 +101,6 @@ static void timeout_handler(event_loop_t *loop, void *data) {
                }
 
                // Also make sure that if outstanding key requests for the UDP counterpart of a connection has timed out, we restart it.
-               if(c->node) {
-                       if(c->node->status.waitingforkey && c->node->last_req_key + pingtimeout < mesh->loop.now.tv_sec) {
-                               send_req_key(mesh, c->node);
-                       }
-               }
-
                if(c->status.active && c->last_key_renewal + 3600 < mesh->loop.now.tv_sec) {
                        devtool_sptps_renewal_probe((meshlink_node_t *)c->node);
 
@@ -189,21 +185,6 @@ static void periodic_handler(event_loop_t *loop, void *data) {
                                logger(mesh, MESHLINK_DEBUG, "Could not update %s", n->name);
                        }
                }
-
-               if(n->status.reachable && n->status.validkey && n->last_req_key + 3600 < mesh->loop.now.tv_sec) {
-                       logger(mesh, MESHLINK_DEBUG, "SPTPS key renewal for node %s", n->name);
-                       devtool_sptps_renewal_probe((meshlink_node_t *)n);
-
-                       if(!sptps_force_kex(&n->sptps)) {
-                               logger(mesh, MESHLINK_ERROR, "SPTPS key renewal for node %s failed", n->name);
-                               n->status.validkey = false;
-                               sptps_stop(&n->sptps);
-                               n->status.waitingforkey = false;
-                               n->last_req_key = -3600;
-                       } else {
-                               n->last_req_key = mesh->loop.now.tv_sec;
-                       }
-               }
        }
 
        timeout_set(&mesh->loop, data, &(struct timespec) {