[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34524 - in gnunet/src: cadet include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34524 - in gnunet/src: cadet include |
Date: |
Thu, 11 Dec 2014 04:42:38 +0100 |
Author: bartpolot
Date: 2014-12-11 04:42:38 +0100 (Thu, 11 Dec 2014)
New Revision: 34524
Modified:
gnunet/src/cadet/cadet_api.c
gnunet/src/include/gnunet_constants.h
Log:
Add maximum message size
Modified: gnunet/src/cadet/cadet_api.c
===================================================================
--- gnunet/src/cadet/cadet_api.c 2014-12-10 20:14:16 UTC (rev 34523)
+++ gnunet/src/cadet/cadet_api.c 2014-12-11 03:42:38 UTC (rev 34524)
@@ -1352,6 +1352,7 @@
psize = th->notify (th->notify_cls,
size - sizeof (struct GNUNET_CADET_LocalData),
mh);
+
if (psize > 0)
{
psize += sizeof (struct GNUNET_CADET_LocalData);
@@ -1379,6 +1380,8 @@
memcpy (cbuf, &th[1], th->size);
psize = th->size;
}
+ GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize);
+
if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (th->timeout_task);
GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
@@ -1709,14 +1712,15 @@
struct GNUNET_CADET_TransmitHandle *
GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, int
cork,
- struct GNUNET_TIME_Relative maxdelay,
- size_t notify_size,
- GNUNET_CONNECTION_TransmitReadyNotify
notify,
- void *notify_cls)
+ struct GNUNET_TIME_Relative maxdelay,
+ size_t notify_size,
+ GNUNET_CONNECTION_TransmitReadyNotify
notify,
+ void *notify_cls)
{
struct GNUNET_CADET_TransmitHandle *th;
GNUNET_assert (NULL != channel);
+ GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= notify_size);
LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY\n");
LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->chid);
LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send);
Modified: gnunet/src/include/gnunet_constants.h
===================================================================
--- gnunet/src/include/gnunet_constants.h 2014-12-10 20:14:16 UTC (rev
34523)
+++ gnunet/src/include/gnunet_constants.h 2014-12-11 03:42:38 UTC (rev
34524)
@@ -121,6 +121,20 @@
#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)
+
+ */
+#define GNUNET_CONSTANTS_CADET_P2P_OVERHEAD (sizeof (struct
GNUNET_CADET_Encrypted) + sizeof (struct GNUNET_CADET_Data))
+
+/**
+ * Same as core, the conservative value would be:
+ * GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE -
GNUNET_CONSTANTS_CADET_P2P_OVERHEAD
+ */
+#define GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE (62 * 1024)
+
+/**
* Largest block that can be stored in the DHT.
*/
#define GNUNET_CONSTANTS_MAX_BLOCK_SIZE (62 * 1024)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34524 - in gnunet/src: cadet include,
gnunet <=