]> git.meshlink.io Git - meshlink/commitdiff
Restart UDP key exchange after PingTimeout if it didn't work.
authorGuus Sliepen <guus@meshlink.io>
Sat, 9 Aug 2014 13:31:00 +0000 (15:31 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sat, 9 Aug 2014 13:31:00 +0000 (15:31 +0200)
src/net.c

index 9d48a283f368e3346dcef49762e51b7540cab029..4045c136fa676912ac42110e6eb0920974cf8650 100644 (file)
--- 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) {