gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r33702 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r33702 - gnunet/src/cadet
Date: Tue, 17 Jun 2014 14:13:46 +0200

Author: bartpolot
Date: 2014-06-17 14:13:46 +0200 (Tue, 17 Jun 2014)
New Revision: 33702

Modified:
   gnunet/src/cadet/gnunet-service-cadet_tunnel.c
Log:
- fix KX for very short rekey periods (seconds)

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-06-17 12:13:45 UTC 
(rev 33701)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-06-17 12:13:46 UTC 
(rev 33702)
@@ -1331,7 +1331,7 @@
 
   t->rekey_task = GNUNET_SCHEDULER_NO_TASK;
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Re-key Tunnel %s\n", GCT_2s (t));
+  LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t));
   if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
     return;
 
@@ -1377,9 +1377,13 @@
   }
 
   // FIXME exponential backoff
+  struct GNUNET_TIME_Relative delay;
+
+  delay = GNUNET_TIME_relative_divide (rekey_period, 16);
+  delay = GNUNET_TIME_relative_min (delay, REKEY_WAIT);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  next call in %s\n",
-       GNUNET_STRINGS_relative_time_to_string (REKEY_WAIT, GNUNET_YES));
-  t->rekey_task = GNUNET_SCHEDULER_add_delayed (REKEY_WAIT, &rekey_tunnel, t);
+       GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
+  t->rekey_task = GNUNET_SCHEDULER_add_delayed (delay, &rekey_tunnel, t);
 }
 
 
@@ -1815,8 +1819,10 @@
 
   send_pong (t, res.nonce);
 }
+
+
 /**
- * @brief Finish the Key eXchange and destory the old keys.
+ * @brief Finish the Key eXchange and destroy the old keys.
  *
  * @param cls Closure (Tunnel for which to finish the KX).
  * @param tc Task context.
@@ -1829,6 +1835,8 @@
   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
     return;
 
+  LOG (GNUNET_ERROR_TYPE_INFO, "finish KX for %s\n", GCT_2s (t));
+
   GNUNET_free (t->kx_ctx);
   t->kx_ctx = NULL;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]