- On a new EPHM, do a immediate rekey
authorBart Polot <bart@net.in.tum.de>
Mon, 21 Jul 2014 00:15:24 +0000 (00:15 +0000)
committerBart Polot <bart@net.in.tum.de>
Mon, 21 Jul 2014 00:15:24 +0000 (00:15 +0000)
src/cadet/gnunet-service-cadet_connection.c
src/cadet/gnunet-service-cadet_tunnel.c

index 5425e258a9b99f33b013c885261d312606085e0c..d46a0a3992df570b468d537be2c909d811c20742 100644 (file)
@@ -1841,7 +1841,7 @@ GCC_handle_broken (void* cls,
      * is popped! Do not use 'c' after the call. */
     while (NULL != (out_msg = GCP_connection_pop (neighbor, c, &del)))
     {
-      pending -= del + 1;
+      pending -= del + 1; /* Substract the deleted messages + the popped one */
       GCT_resend_message (out_msg, t);
     }
     /* All pending messages should have been popped,
index fffdb9102bf433769364289c5aefc2ee409883d2..2d8aa90b6edace00f165e5436abd407fabc16250 100644 (file)
@@ -1838,8 +1838,9 @@ handle_ephemeral (struct CadetTunnel *t,
     {
       t->estate = CADET_TUNNEL_KEY_REKEY;
     }
-    if (GNUNET_SCHEDULER_NO_TASK == t->rekey_task)
-      t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t);
+    if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task)
+      GNUNET_SCHEDULER_cancel (t->rekey_task);
+    t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t);
   }
   else if (CADET_TUNNEL_KEY_OK == t->estate)
   {