diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-05-05 12:10:01 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-05-05 12:10:01 +0200 |
commit | b84057d7593651e16a161de9f2ec51f93c98589d (patch) | |
tree | e5607a9912e29446f900e891e39a210cefc885dc /src/transport | |
parent | a90f8587871a66a71c802c2c8823c7a44d0f6d2c (diff) | |
download | gnunet-b84057d7593651e16a161de9f2ec51f93c98589d.tar.gz gnunet-b84057d7593651e16a161de9f2ec51f93c98589d.zip |
DCE, set message UUID to incrementing counter
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-tng.c | 51 |
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 | |||
298 | 298 | ||
299 | 299 | ||
300 | /** | 300 | /** |
301 | * Unique identifier we attach to a message. | ||
302 | */ | ||
303 | struct FragmentUUIDP | ||
304 | { | ||
305 | /** | ||
306 | * Unique value identifying a fragment, in NBO. | ||
307 | */ | ||
308 | uint32_t uuid GNUNET_PACKED; | ||
309 | }; | ||
310 | |||
311 | |||
312 | /** | ||
313 | * Type of a nonce used for challenges. | 301 | * Type of a nonce used for challenges. |
314 | */ | 302 | */ |
315 | struct ChallengeNonceP | 303 | struct ChallengeNonceP |
@@ -527,6 +515,16 @@ struct TransportFragmentBoxMessage | |||
527 | struct GNUNET_MessageHeader header; | 515 | struct GNUNET_MessageHeader header; |
528 | 516 | ||
529 | /** | 517 | /** |
518 | * Offset of this fragment in the overall message. | ||
519 | */ | ||
520 | uint16_t frag_off GNUNET_PACKED; | ||
521 | |||
522 | /** | ||
523 | * Total size of the message that is being fragmented. | ||
524 | */ | ||
525 | uint16_t msg_size GNUNET_PACKED; | ||
526 | |||
527 | /** | ||
530 | * Unique ID of this fragment (and fragment transmission!). Will | 528 | * Unique ID of this fragment (and fragment transmission!). Will |
531 | * change even if a fragement is retransmitted to make each | 529 | * change even if a fragement is retransmitted to make each |
532 | * transmission attempt unique! If a client receives a duplicate | 530 | * transmission attempt unique! If a client receives a duplicate |
@@ -540,16 +538,6 @@ struct TransportFragmentBoxMessage | |||
540 | * belong to. Must be the same for all fragments. | 538 | * belong to. Must be the same for all fragments. |
541 | */ | 539 | */ |
542 | struct MessageUUIDP msg_uuid; | 540 | struct MessageUUIDP msg_uuid; |
543 | |||
544 | /** | ||
545 | * Offset of this fragment in the overall message. | ||
546 | */ | ||
547 | uint16_t frag_off GNUNET_PACKED; | ||
548 | |||
549 | /** | ||
550 | * Total size of the message that is being fragmented. | ||
551 | */ | ||
552 | uint16_t msg_size GNUNET_PACKED; | ||
553 | }; | 541 | }; |
554 | 542 | ||
555 | 543 | ||
@@ -1618,13 +1606,6 @@ struct ReassemblyContext | |||
1618 | uint8_t *bitfield; | 1606 | uint8_t *bitfield; |
1619 | 1607 | ||
1620 | /** | 1608 | /** |
1621 | * Task for sending ACK. We may send ACKs either because of hitting | ||
1622 | * the @e extra_acks limit, or based on time and @e num_acks. This | ||
1623 | * task is for the latter case. | ||
1624 | */ | ||
1625 | struct GNUNET_SCHEDULER_Task *ack_task; | ||
1626 | |||
1627 | /** | ||
1628 | * At what time will we give up reassembly of this message? | 1609 | * At what time will we give up reassembly of this message? |
1629 | */ | 1610 | */ |
1630 | struct GNUNET_TIME_Absolute reassembly_timeout; | 1611 | struct GNUNET_TIME_Absolute reassembly_timeout; |
@@ -1740,6 +1721,12 @@ struct Neighbour | |||
1740 | struct GNUNET_TIME_Absolute last_dv_learn_monotime; | 1721 | struct GNUNET_TIME_Absolute last_dv_learn_monotime; |
1741 | 1722 | ||
1742 | /** | 1723 | /** |
1724 | * Used to generate unique UUIDs for messages that are being | ||
1725 | * fragmented. | ||
1726 | */ | ||
1727 | uint64_t message_uuid_ctr; | ||
1728 | |||
1729 | /** | ||
1743 | * Do we have the lastest value for @e last_dv_learn_monotime from | 1730 | * Do we have the lastest value for @e last_dv_learn_monotime from |
1744 | * PEERSTORE yet, or are we still waiting for a reply of PEERSTORE? | 1731 | * PEERSTORE yet, or are we still waiting for a reply of PEERSTORE? |
1745 | */ | 1732 | */ |
@@ -7253,9 +7240,7 @@ set_pending_message_uuid (struct PendingMessage *pm) | |||
7253 | { | 7240 | { |
7254 | if (pm->msg_uuid_set) | 7241 | if (pm->msg_uuid_set) |
7255 | return; | 7242 | return; |
7256 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, | 7243 | pm->msg_uuid.uuid = pm->target->message_uuid_ctr++; |
7257 | &pm->msg_uuid, | ||
7258 | sizeof (pm->msg_uuid)); | ||
7259 | pm->msg_uuid_set = GNUNET_YES; | 7244 | pm->msg_uuid_set = GNUNET_YES; |
7260 | } | 7245 | } |
7261 | 7246 | ||
@@ -8240,6 +8225,8 @@ handle_add_queue_message (void *cls, | |||
8240 | if (NULL == neighbour) | 8225 | if (NULL == neighbour) |
8241 | { | 8226 | { |
8242 | neighbour = GNUNET_new (struct Neighbour); | 8227 | neighbour = GNUNET_new (struct Neighbour); |
8228 | neighbour->message_uuid_ctr = | ||
8229 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); | ||
8243 | neighbour->pid = aqm->receiver; | 8230 | neighbour->pid = aqm->receiver; |
8244 | GNUNET_assert (GNUNET_OK == | 8231 | GNUNET_assert (GNUNET_OK == |
8245 | GNUNET_CONTAINER_multipeermap_put ( | 8232 | GNUNET_CONTAINER_multipeermap_put ( |