summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-tng.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-05-05 12:10:01 +0200
committerChristian Grothoff <christian@grothoff.org>2019-05-05 12:10:01 +0200
commitb84057d7593651e16a161de9f2ec51f93c98589d (patch)
treee5607a9912e29446f900e891e39a210cefc885dc /src/transport/gnunet-service-tng.c
parenta90f8587871a66a71c802c2c8823c7a44d0f6d2c (diff)
DCE, set message UUID to incrementing counter
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r--src/transport/gnunet-service-tng.c51
1 files changed, 19 insertions, 32 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index b217c8aa9..443c7f245 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -298,18 +298,6 @@ struct AcknowledgementUUIDP
/**
- * Unique identifier we attach to a message.
- */
-struct FragmentUUIDP
-{
- /**
- * Unique value identifying a fragment, in NBO.
- */
- uint32_t uuid GNUNET_PACKED;
-};
-
-
-/**
* Type of a nonce used for challenges.
*/
struct ChallengeNonceP
@@ -527,6 +515,16 @@ struct TransportFragmentBoxMessage
struct GNUNET_MessageHeader header;
/**
+ * Offset of this fragment in the overall message.
+ */
+ uint16_t frag_off GNUNET_PACKED;
+
+ /**
+ * Total size of the message that is being fragmented.
+ */
+ uint16_t msg_size GNUNET_PACKED;
+
+ /**
* Unique ID of this fragment (and fragment transmission!). Will
* change even if a fragement is retransmitted to make each
* transmission attempt unique! If a client receives a duplicate
@@ -540,16 +538,6 @@ struct TransportFragmentBoxMessage
* belong to. Must be the same for all fragments.
*/
struct MessageUUIDP msg_uuid;
-
- /**
- * Offset of this fragment in the overall message.
- */
- uint16_t frag_off GNUNET_PACKED;
-
- /**
- * Total size of the message that is being fragmented.
- */
- uint16_t msg_size GNUNET_PACKED;
};
@@ -1618,13 +1606,6 @@ struct ReassemblyContext
uint8_t *bitfield;
/**
- * Task for sending ACK. We may send ACKs either because of hitting
- * the @e extra_acks limit, or based on time and @e num_acks. This
- * task is for the latter case.
- */
- struct GNUNET_SCHEDULER_Task *ack_task;
-
- /**
* At what time will we give up reassembly of this message?
*/
struct GNUNET_TIME_Absolute reassembly_timeout;
@@ -1740,6 +1721,12 @@ struct Neighbour
struct GNUNET_TIME_Absolute last_dv_learn_monotime;
/**
+ * Used to generate unique UUIDs for messages that are being
+ * fragmented.
+ */
+ uint64_t message_uuid_ctr;
+
+ /**
* Do we have the lastest value for @e last_dv_learn_monotime from
* PEERSTORE yet, or are we still waiting for a reply of PEERSTORE?
*/
@@ -7253,9 +7240,7 @@ set_pending_message_uuid (struct PendingMessage *pm)
{
if (pm->msg_uuid_set)
return;
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
- &pm->msg_uuid,
- sizeof (pm->msg_uuid));
+ pm->msg_uuid.uuid = pm->target->message_uuid_ctr++;
pm->msg_uuid_set = GNUNET_YES;
}
@@ -8240,6 +8225,8 @@ handle_add_queue_message (void *cls,
if (NULL == neighbour)
{
neighbour = GNUNET_new (struct Neighbour);
+ neighbour->message_uuid_ctr =
+ GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
neighbour->pid = aqm->receiver;
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multipeermap_put (