- timeout_set(&mesh->loop, data, &(struct timeval) {
- timeout, rand() % 100000
+ for splay_each(node_t, n, mesh->nodes) {
+ if(n->status.dirty) {
+ if(!node_write_config(mesh, n)) {
+ logger(mesh, MESHLINK_DEBUG, "Could not update %s", n->name);
+ }
+
+ n->status.dirty = false;
+ }
+
+ if(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) {
+ timeout, prng(mesh, TIMER_FUDGE)