From: Guus Sliepen Date: Sat, 9 Aug 2014 13:31:00 +0000 (+0200) Subject: Restart UDP key exchange after PingTimeout if it didn't work. X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=31fd68419f7bd9b33ad18d75fbf0eef1af86905d Restart UDP key exchange after PingTimeout if it didn't work. --- 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) {