From 31fd68419f7bd9b33ad18d75fbf0eef1af86905d Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 9 Aug 2014 15:31:00 +0200 Subject: [PATCH] Restart UDP key exchange after PingTimeout if it didn't work. --- src/net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/net.c b/src/net.c index 9d48a283..4045c136 100644 --- a/src/net.c +++ b/src/net.c @@ -98,8 +98,14 @@ void terminate_connection(meshlink_handle_t *mesh, connection_t *c, bool report) */ static void timeout_handler(event_loop_t *loop, void *data) { meshlink_handle_t *mesh = loop->data; + logger(mesh, MESHLINK_DEBUG, "timeout_handler()"); for list_each(connection_t, c, mesh->connections) { + // 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 + mesh->pingtimeout <= mesh->loop.now.tv_sec) + send_req_key(mesh, c->node); + } if(c->last_ping_time + mesh->pingtimeout <= mesh->loop.now.tv_sec) { if(c->status.active) { if(c->status.pinged) { -- 2.39.2