gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34534 - in gnunet/src: cadet include


From: gnunet
Subject: [GNUnet-SVN] r34534 - in gnunet/src: cadet include
Date: Thu, 11 Dec 2014 20:01:29 +0100

Author: bartpolot
Date: 2014-12-11 20:01:29 +0100 (Thu, 11 Dec 2014)
New Revision: 34534

Modified:
   gnunet/src/cadet/gnunet-service-cadet.c
   gnunet/src/cadet/gnunet-service-cadet_channel.c
   gnunet/src/cadet/gnunet-service-cadet_tunnel.c
   gnunet/src/include/gnunet_constants.h
Log:
- proper CADET overhead

Modified: gnunet/src/cadet/gnunet-service-cadet.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet.c     2014-12-11 14:57:46 UTC (rev 
34533)
+++ gnunet/src/cadet/gnunet-service-cadet.c     2014-12-11 19:01:29 UTC (rev 
34534)
@@ -168,14 +168,18 @@
 int
 main (int argc, char *const *argv)
 {
-  int ret;
   int r;
 
   shutting_down = GNUNET_NO;
   r = GNUNET_SERVICE_run (argc, argv, "cadet", GNUNET_SERVICE_OPTION_NONE, 
&run,
                           NULL);
   GNUNET_free (my_private_key);
-  ret = (GNUNET_OK == r) ? 0 : 1;
 
-  return ret;
+  if (GNUNET_OK != r)
+  {
+    FPRINTF (stderr, "GNUNET_SERVICE_run for CADET has failed!\n");
+    return 1;
+  }
+
+  return 0;
 }

Modified: gnunet/src/cadet/gnunet-service-cadet_channel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_channel.c     2014-12-11 14:57:46 UTC 
(rev 34533)
+++ gnunet/src/cadet/gnunet-service-cadet_channel.c     2014-12-11 19:01:29 UTC 
(rev 34534)
@@ -737,7 +737,7 @@
   copy = rel->head_sent;
   if (NULL == copy)
   {
-    GNUNET_break (0);
+    GNUNET_break (0); // FIXME tripped in rps testcase
     return;
   }
 
@@ -1778,6 +1778,8 @@
 /**
  * Handle a channel destroy requested by a client.
  *
+ * TODO: add "reason" field
+ *
  * Destroy the channel and the tunnel in case this was the last channel.
  *
  * @param ch Channel.

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-12-11 14:57:46 UTC 
(rev 34533)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-12-11 19:01:29 UTC 
(rev 34534)
@@ -2143,7 +2143,14 @@
 GCT_init (const struct GNUNET_CONFIGURATION_Handle *c,
           const struct GNUNET_CRYPTO_EddsaPrivateKey *key)
 {
+  int expected_overhead;
+
   LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
+
+  expected_overhead =
+    sizeof (struct GNUNET_CADET_Encrypted) + sizeof (struct GNUNET_CADET_Data);
+  GNUNET_assert (GNUNET_CONSTANTS_CADET_P2P_OVERHEAD == expected_overhead);
+
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (c, "CADET", "DEFAULT_TTL",
                                              &default_ttl))

Modified: gnunet/src/include/gnunet_constants.h
===================================================================
--- gnunet/src/include/gnunet_constants.h       2014-12-11 14:57:46 UTC (rev 
34533)
+++ gnunet/src/include/gnunet_constants.h       2014-12-11 19:01:29 UTC (rev 
34534)
@@ -121,18 +121,16 @@
 #define GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE (63 * 1024)
 
 /**
- * Size of the CADET message overhead
- * - sizeof(GNUNET_CADET_Encrypted) // FIXME use GNUNET_CADET_EncryptedAck 
when available
- * - sizeof(GNUNET_CADET_Data)
-
+ * Size of the CADET message overhead.
+ * See gnunet-service-cadet_tunnel.c: GCT_init for more info.
  */
-#define GNUNET_CONSTANTS_CADET_P2P_OVERHEAD (sizeof (struct 
GNUNET_CADET_Encrypted) + sizeof (struct GNUNET_CADET_Data))
+#define GNUNET_CONSTANTS_CADET_P2P_OVERHEAD 92
 
 /**
- * Same as core, the conservative value would be:
- * GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE - 
GNUNET_CONSTANTS_CADET_P2P_OVERHEAD
+ * Maximum message size that can be sent on CADET.
  */
-#define GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE (62 * 1024)
+#define GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE \
+(GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE - 
GNUNET_CONSTANTS_CADET_P2P_OVERHEAD)
 
 /**
  * Largest block that can be stored in the DHT.




reply via email to

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