gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r36074 - gnunet/src/cadet
Date: Wed, 15 Jul 2015 13:45:11 +0200

Author: bartpolot
Date: 2015-07-15 13:45:11 +0200 (Wed, 15 Jul 2015)
New Revision: 36074

Modified:
   gnunet/src/cadet/gnunet-service-cadet_tunnel.c
Log:
- fix end of kx condition to reception of valid payload only

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2015-07-15 11:45:10 UTC 
(rev 36073)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2015-07-15 11:45:11 UTC 
(rev 36074)
@@ -2037,7 +2037,11 @@
     return;
 
   if (CADET_TUNNEL_KEY_OK == t->estate)
+  {
+    /* Should have been canceled on estate change */
+    GNUNET_break (0);
     return;
+  }
 
   GCT_send_ax_kx (t, GNUNET_YES);
 }
@@ -2066,7 +2070,7 @@
   if (CADET_TUNNEL_KEY_OK == t->estate)
     return;
 
-  if (CADET_Axolotl == t->enc_type && CADET_TUNNEL_KEY_OK != t->estate)
+  if (CADET_Axolotl == t->enc_type)
   {
     if (NULL != t->rekey_task)
     {
@@ -2973,7 +2977,6 @@
     ax->ratchet_expiration =
       GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), ratchet_time);
   }
-  GCT_change_estate (t, CADET_TUNNEL_KEY_OK);
 }
 
 
@@ -3039,6 +3042,7 @@
   }
 }
 
+
 
/******************************************************************************/
 /********************************    API    
***********************************/
 
/******************************************************************************/
@@ -3086,6 +3090,7 @@
     GNUNET_break_op (0);
     return;
   }
+
   if (-1 == decrypted_size)
   {
     GNUNET_break_op (0);
@@ -3093,6 +3098,7 @@
     GCT_debug (t, GNUNET_ERROR_TYPE_WARNING);
     return;
   }
+  GCT_change_estate (t, CADET_TUNNEL_KEY_OK);
 
   /* FIXME: this is bad, as the structs returned from
      this loop may be unaligned, see util's MST for
@@ -3305,6 +3311,8 @@
 /**
  * Change the tunnel encryption state.
  *
+ * If the encryption state changes to OK, stop the rekey task.
+ *
  * @param t Tunnel whose encryption state to change, or NULL.
  * @param state New encryption state.
  */
@@ -3323,11 +3331,16 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s estate is now %s\n",
        GCP_2s (t->peer), estate2s (t->estate));
 
-  /* Send queued data if enc state changes to OK */
-  if (myid != GCP_get_short_id (t->peer) &&
-      CADET_TUNNEL_KEY_OK != old && CADET_TUNNEL_KEY_OK == t->estate)
+  if (CADET_TUNNEL_KEY_OK != old && CADET_TUNNEL_KEY_OK == t->estate)
   {
-    send_queued_data (t);
+    if (NULL != t->rekey_task)
+    {
+      GNUNET_SCHEDULER_cancel (t->rekey_task);
+      t->rekey_task = NULL;
+    }
+    /* Send queued data if tunnel is not loopback */
+    if (myid != GCP_get_short_id (t->peer))
+      send_queued_data (t);
   }
 }
 




reply via email to

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