aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2022-04-01 15:07:32 +0200
committert3sserakt <t3ss@posteo.de>2022-04-01 15:07:32 +0200
commit027177be3bae0c60d530b0b88ed375b082c94d81 (patch)
treeb5de67e190c66f6fa341418661b0c86ca2f3a9bb
parent8d41efc36bec5bc5ec29278a365d5a63d7349084 (diff)
downloadgnunet-027177be3bae0c60d530b0b88ed375b082c94d81.tar.gz
gnunet-027177be3bae0c60d530b0b88ed375b082c94d81.zip
- Introduced check, if we need to rebuild a DV box, because we have a different path.
- Bug fix when freeing PendingMessage structs, in case of more complex hierarchies of pending messages. E.g. root msg -> DV Box -> reliability box. - Bug fix in backtalker logic. - Change logic, if MTU changes to keep already computed fragments. - Introduced a retry delay, if pending messages are not ready again. - Added schedule_transmit_on_queue, if communicator tells us about having capacity again. - Bug fixed in store request sent callback. - Some smaller bug fixes.
-rw-r--r--src/peerstore/peerstore_api.c19
-rw-r--r--src/transport/gnunet-service-tng.c250
-rw-r--r--src/transport/test_transport_api2_tcp_node1.conf5
-rw-r--r--src/transport/test_transport_start_with_config.c2
4 files changed, 200 insertions, 76 deletions
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c
index 502b38646..d0c72acf1 100644
--- a/src/peerstore/peerstore_api.c
+++ b/src/peerstore/peerstore_api.c
@@ -323,11 +323,14 @@ store_request_sent (void *cls)
323 GNUNET_PEERSTORE_Continuation cont; 323 GNUNET_PEERSTORE_Continuation cont;
324 void *cont_cls; 324 void *cont_cls;
325 325
326 cont = sc->cont; 326 if (NULL != sc)
327 cont_cls = sc->cont_cls; 327 {
328 GNUNET_PEERSTORE_store_cancel (sc); 328 cont = sc->cont;
329 if (NULL != cont) 329 cont_cls = sc->cont_cls;
330 cont (cont_cls, GNUNET_OK); 330 GNUNET_PEERSTORE_store_cancel (sc);
331 if (NULL != cont)
332 cont (cont_cls, GNUNET_OK);
333 }
331} 334}
332 335
333 336
@@ -492,11 +495,17 @@ GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc)
492{ 495{
493 struct GNUNET_PEERSTORE_Handle *h = sc->h; 496 struct GNUNET_PEERSTORE_Handle *h = sc->h;
494 497
498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
499 "store cancel with sc %p \n",
500 sc);
495 GNUNET_CONTAINER_DLL_remove (sc->h->store_head, sc->h->store_tail, sc); 501 GNUNET_CONTAINER_DLL_remove (sc->h->store_head, sc->h->store_tail, sc);
496 GNUNET_free (sc->sub_system); 502 GNUNET_free (sc->sub_system);
497 GNUNET_free (sc->value); 503 GNUNET_free (sc->value);
498 GNUNET_free (sc->key); 504 GNUNET_free (sc->key);
499 GNUNET_free (sc); 505 GNUNET_free (sc);
506 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
507 "store cancel with sc %p is null\n",
508 sc);
500 if ((GNUNET_YES == h->disconnecting) && (NULL == h->store_head)) 509 if ((GNUNET_YES == h->disconnecting) && (NULL == h->store_head))
501 final_disconnect (h); 510 final_disconnect (h);
502} 511}
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 21c9be05c..0eec2f367 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -2235,6 +2235,11 @@ struct PendingMessage
2235 enum GNUNET_MQ_PriorityPreferences prefs; 2235 enum GNUNET_MQ_PriorityPreferences prefs;
2236 2236
2237 /** 2237 /**
2238 * If pmt is of type PMT_DV_BOX we store the used path here.
2239 */
2240 struct DistanceVectorHop *used_dvh;
2241
2242 /**
2238 * Size of the original message. 2243 * Size of the original message.
2239 */ 2244 */
2240 uint16_t bytes_msg; 2245 uint16_t bytes_msg;
@@ -2937,6 +2942,21 @@ free_fragment_tree (struct PendingMessage *root)
2937 pa->pm = NULL; 2942 pa->pm = NULL;
2938 } 2943 }
2939 GNUNET_CONTAINER_MDLL_remove (frag, root->head_frag, root->tail_frag, frag); 2944 GNUNET_CONTAINER_MDLL_remove (frag, root->head_frag, root->tail_frag, frag);
2945 if (NULL != frag->qe)
2946 {
2947 GNUNET_assert (frag == frag->qe->pm);
2948 frag->qe->pm = NULL;
2949 GNUNET_CONTAINER_DLL_remove (frag->qe->queue->queue_head,
2950 frag->qe->queue->queue_tail,
2951 frag->qe);
2952 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2953 "Removing QueueEntry MID %llu from queue\n",
2954 frag->qe->mid);
2955 GNUNET_free (frag->qe);
2956 }
2957 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2958 "Free frag %p\n",
2959 frag);
2940 GNUNET_free (frag); 2960 GNUNET_free (frag);
2941 } 2961 }
2942} 2962}
@@ -2956,6 +2976,9 @@ free_pending_message (struct PendingMessage *pm)
2956 struct VirtualLink *vl = pm->vl; 2976 struct VirtualLink *vl = pm->vl;
2957 struct PendingAcknowledgement *pa; 2977 struct PendingAcknowledgement *pa;
2958 2978
2979 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2980 "Freeing pm %p\n",
2981 pm);
2959 if (NULL != tc) 2982 if (NULL != tc)
2960 { 2983 {
2961 GNUNET_CONTAINER_MDLL_remove (client, 2984 GNUNET_CONTAINER_MDLL_remove (client,
@@ -2996,6 +3019,13 @@ free_pending_message (struct PendingMessage *pm)
2996 { 3019 {
2997 GNUNET_assert (pm == pm->qe->pm); 3020 GNUNET_assert (pm == pm->qe->pm);
2998 pm->qe->pm = NULL; 3021 pm->qe->pm = NULL;
3022 GNUNET_CONTAINER_DLL_remove (pm->qe->queue->queue_head,
3023 pm->qe->queue->queue_tail,
3024 pm->qe);
3025 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3026 "Removing QueueEntry MID %llu from queue\n",
3027 pm->qe->mid);
3028 GNUNET_free (pm->qe);
2999 } 3029 }
3000 if (NULL != pm->bpm) 3030 if (NULL != pm->bpm)
3001 { 3031 {
@@ -3090,7 +3120,8 @@ free_virtual_link (struct VirtualLink *vl)
3090 struct CoreSentContext *csc; 3120 struct CoreSentContext *csc;
3091 3121
3092 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3093 "free virtual link\n"); 3123 "free virtual link %p\n",
3124 vl);
3094 3125
3095 if (NULL != vl->reassembly_map) 3126 if (NULL != vl->reassembly_map)
3096 { 3127 {
@@ -3624,8 +3655,9 @@ schedule_transmit_on_queue (struct GNUNET_TIME_Relative delay,
3624 GNUNET_SCHEDULER_add_delayed_with_priority (delay, p, &transmit_on_queue, 3655 GNUNET_SCHEDULER_add_delayed_with_priority (delay, p, &transmit_on_queue,
3625 queue); 3656 queue);
3626 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3657 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3627 "Considering transmission on queue `%s' to %s\n", 3658 "Considering transmission on queue `%s' QID %llu to %s\n",
3628 queue->address, 3659 queue->address,
3660 (unsigned long long) queue->qid,
3629 GNUNET_i2s (&queue->neighbour->pid)); 3661 GNUNET_i2s (&queue->neighbour->pid));
3630} 3662}
3631 3663
@@ -4385,6 +4417,8 @@ queue_send_msg (struct Queue *queue,
4385 GNUNET_assert (CT_COMMUNICATOR == queue->tc->type); 4417 GNUNET_assert (CT_COMMUNICATOR == queue->tc->type);
4386 queue->queue_length++; 4418 queue->queue_length++;
4387 queue->tc->details.communicator.total_queue_length++; 4419 queue->tc->details.communicator.total_queue_length++;
4420 if (0 == queue->q_capacity)
4421 return;
4388 if (GNUNET_NO == queue->unlimited_length) 4422 if (GNUNET_NO == queue->unlimited_length)
4389 queue->q_capacity--; 4423 queue->q_capacity--;
4390 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4424 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -4400,7 +4434,8 @@ queue_send_msg (struct Queue *queue,
4400 if (0 == queue->q_capacity) 4434 if (0 == queue->q_capacity)
4401 queue->idle = GNUNET_NO; 4435 queue->idle = GNUNET_NO;
4402 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4436 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4403 "Sending message of type %u (%u) and size %u with MQ %p\n", 4437 "Sending message MID %llu of type %u (%u) and size %u with MQ %p\n",
4438 smt->mid,
4404 ntohs (((const struct GNUNET_MessageHeader *) payload)->type), 4439 ntohs (((const struct GNUNET_MessageHeader *) payload)->type),
4405 ntohs (smt->header.size), 4440 ntohs (smt->header.size),
4406 payload_size, 4441 payload_size,
@@ -5211,6 +5246,10 @@ handle_client_send (void *cls, const struct OutboundMessage *obm)
5211 } 5246 }
5212 5247
5213 pm = GNUNET_malloc (sizeof(struct PendingMessage) + bytes_msg); 5248 pm = GNUNET_malloc (sizeof(struct PendingMessage) + bytes_msg);
5249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5250 "1 created pm %p storing vl %p\n",
5251 pm,
5252 vl);
5214 pm->logging_uuid = logging_uuid_gen++; 5253 pm->logging_uuid = logging_uuid_gen++;
5215 pm->prefs = pp; 5254 pm->prefs = pp;
5216 pm->client = tc; 5255 pm->client = tc;
@@ -6218,24 +6257,27 @@ completed_pending_message (struct PendingMessage *pm)
6218 6257
6219 case PMT_FRAGMENT_BOX: 6258 case PMT_FRAGMENT_BOX:
6220 /* Fragment sent over reliable channel */ 6259 /* Fragment sent over reliable channel */
6221 free_fragment_tree (pm);
6222 pos = pm->frag_parent; 6260 pos = pm->frag_parent;
6223 GNUNET_CONTAINER_MDLL_remove (frag, pos->head_frag, pos->tail_frag, pm); 6261 GNUNET_CONTAINER_MDLL_remove (frag, pos->head_frag, pos->tail_frag, pm);
6224 GNUNET_free (pm); 6262 free_pending_message (pm);
6225 /* check if subtree is done */ 6263 /* check if subtree is done */
6226 while ((NULL == pos->head_frag) && (pos->frag_off == pos->bytes_msg) && 6264 while ((NULL == pos->head_frag) && (pos->frag_off == pos->bytes_msg) &&
6227 (pos != pm)) 6265 (NULL != pos->frag_parent))
6228 { 6266 {
6229 pm = pos; 6267 pm = pos;
6230 pos = pm->frag_parent; 6268 pos = pm->frag_parent;
6231 if (PMT_DV_BOX == pm->pmt) 6269 if ((NULL == pos) && (PMT_DV_BOX == pm->pmt))
6270 {
6271 client_send_response (pm);
6272 return;
6273 }
6274 else if (PMT_DV_BOX == pm->pmt)
6232 { 6275 {
6233 GNUNET_free (pm);
6234 client_send_response (pos); 6276 client_send_response (pos);
6235 return; 6277 return;
6236 } 6278 }
6237 GNUNET_CONTAINER_MDLL_remove (frag, pos->head_frag, pos->tail_frag, pm); 6279 GNUNET_CONTAINER_MDLL_remove (frag, pos->head_frag, pos->tail_frag, pm);
6238 GNUNET_free (pm); 6280 free_pending_message (pm);
6239 } 6281 }
6240 6282
6241 /* Was this the last applicable fragment? */ 6283 /* Was this the last applicable fragment? */
@@ -6248,7 +6290,16 @@ completed_pending_message (struct PendingMessage *pm)
6248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 6290 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6249 "Completed transmission of message %llu (DV Box)\n", 6291 "Completed transmission of message %llu (DV Box)\n",
6250 pm->logging_uuid); 6292 pm->logging_uuid);
6251 free_pending_message (pm); 6293 if (NULL != pm->frag_parent)
6294 {
6295 if (NULL != pm->bpm)
6296 {
6297 GNUNET_free (pm->bpm);
6298 }
6299 client_send_response (pm->frag_parent);
6300 }
6301 else
6302 client_send_response (pm);
6252 return; 6303 return;
6253 } 6304 }
6254} 6305}
@@ -6517,10 +6568,12 @@ activate_core_visible_dv_path (struct DistanceVectorHop *hop)
6517 vl = lookup_virtual_link (&dv->target); 6568 vl = lookup_virtual_link (&dv->target);
6518 if (NULL == vl) 6569 if (NULL == vl)
6519 { 6570 {
6571
6572 vl = GNUNET_new (struct VirtualLink);
6520 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 6573 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6521 "Creating new virtual link to %s using DV!\n", 6574 "Creating new virtual link %p to %s using DV!\n",
6575 vl,
6522 GNUNET_i2s (&dv->target)); 6576 GNUNET_i2s (&dv->target));
6523 vl = GNUNET_new (struct VirtualLink);
6524 vl->confirmed = GNUNET_YES; 6577 vl->confirmed = GNUNET_YES;
6525 vl->message_uuid_ctr = 6578 vl->message_uuid_ctr =
6526 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); 6579 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
@@ -7528,14 +7581,6 @@ forward_dv_box (struct Neighbour *next_hop,
7528 char msg_buf[msg_size] GNUNET_ALIGN; 7581 char msg_buf[msg_size] GNUNET_ALIGN;
7529 struct GNUNET_PeerIdentity *dhops; 7582 struct GNUNET_PeerIdentity *dhops;
7530 7583
7531 if (GNUNET_NO == ntohs (hdr->without_fc))
7532 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7533 "forward dv box without fc\n");
7534 if (NULL == vl)
7535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7536 "forward dv box vl null\n");
7537 GNUNET_assert (GNUNET_YES == ntohs (hdr->without_fc) || NULL != vl);
7538
7539 hdr->num_hops = htons (num_hops); 7584 hdr->num_hops = htons (num_hops);
7540 hdr->total_hops = htons (total_hops); 7585 hdr->total_hops = htons (total_hops);
7541 hdr->header.size = htons (msg_size); 7586 hdr->header.size = htons (msg_size);
@@ -7557,9 +7602,13 @@ forward_dv_box (struct Neighbour *next_hop,
7557 GNUNET_MessageHeader *) msg_buf, 7602 GNUNET_MessageHeader *) msg_buf,
7558 RMO_ANYTHING_GOES); 7603 RMO_ANYTHING_GOES);
7559 } 7604 }
7560 else 7605 else if (NULL != vl)
7561 { 7606 {
7562 pm = GNUNET_malloc (sizeof(struct PendingMessage) + msg_size); 7607 pm = GNUNET_malloc (sizeof(struct PendingMessage) + msg_size);
7608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7609 "2 created pm %p storing vl %p \n",
7610 pm,
7611 vl);
7563 pm->pmt = PMT_DV_BOX; 7612 pm->pmt = PMT_DV_BOX;
7564 pm->vl = vl; 7613 pm->vl = vl;
7565 pm->timeout = GNUNET_TIME_relative_to_absolute (DV_FORWARD_TIMEOUT); 7614 pm->timeout = GNUNET_TIME_relative_to_absolute (DV_FORWARD_TIMEOUT);
@@ -7580,6 +7629,12 @@ forward_dv_box (struct Neighbour *next_hop,
7580 (unsigned int) total_hops); 7629 (unsigned int) total_hops);
7581 check_vl_transmission (vl); 7630 check_vl_transmission (vl);
7582 } 7631 }
7632 else
7633 {
7634 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7635 "The virtual link is not ready for forwarding a DV Box with payload.\n");
7636 // FIXME The DV Box was send before the validation response. Shall we send a validation request for DV paths?
7637 }
7583} 7638}
7584 7639
7585 7640
@@ -7611,6 +7666,9 @@ free_backtalker (struct Backtalker *b)
7611 GNUNET_PEERSTORE_store_cancel (b->sc); 7666 GNUNET_PEERSTORE_store_cancel (b->sc);
7612 b->sc = NULL; 7667 b->sc = NULL;
7613 } 7668 }
7669 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7670 "Removing backtalker for %s\n",
7671 GNUNET_i2s (&b->pid));
7614 GNUNET_assert ( 7672 GNUNET_assert (
7615 GNUNET_YES == 7673 GNUNET_YES ==
7616 GNUNET_CONTAINER_multipeermap_remove (backtalkers, &b->pid, b)); 7674 GNUNET_CONTAINER_multipeermap_remove (backtalkers, &b->pid, b));
@@ -7739,6 +7797,11 @@ backtalker_monotime_store_cb (void *cls, int success)
7739 "Failed to store backtalker's monotonic time in PEERSTORE!\n"); 7797 "Failed to store backtalker's monotonic time in PEERSTORE!\n");
7740 } 7798 }
7741 b->sc = NULL; 7799 b->sc = NULL;
7800 if (NULL != b->task)
7801 {
7802 GNUNET_SCHEDULER_cancel (b->task);
7803 b->task = NULL;
7804 }
7742 b->task = GNUNET_SCHEDULER_add_at (b->timeout, &backtalker_timeout_cb, b); 7805 b->task = GNUNET_SCHEDULER_add_at (b->timeout, &backtalker_timeout_cb, b);
7743} 7806}
7744 7807
@@ -7756,9 +7819,13 @@ update_backtalker_monotime (struct Backtalker *b)
7756 if (NULL != b->sc) 7819 if (NULL != b->sc)
7757 { 7820 {
7758 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 7821 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7759 "store cancel\n"); 7822 "store cancel before store with sc %p\n",
7760 GNUNET_PEERSTORE_store_cancel (b->sc); 7823 b->sc);
7761 b->sc = NULL; 7824 /*GNUNET_PEERSTORE_store_cancel (b->sc);
7825 b->sc = NULL;*/
7826 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7827 "store cancel before store with sc %p is null\n",
7828 b->sc);
7762 } 7829 }
7763 else 7830 else
7764 { 7831 {
@@ -8550,10 +8617,11 @@ handle_validation_response (
8550 vl = lookup_virtual_link (&vs->pid); 8617 vl = lookup_virtual_link (&vs->pid);
8551 if (NULL == vl) 8618 if (NULL == vl)
8552 { 8619 {
8620 vl = GNUNET_new (struct VirtualLink);
8553 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 8621 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8554 "Creating new virtual link to %s using direct neighbour!\n", 8622 "Creating new virtual link %p to %s using direct neighbour!\n",
8623 vl,
8555 GNUNET_i2s (&vs->pid)); 8624 GNUNET_i2s (&vs->pid));
8556 vl = GNUNET_new (struct VirtualLink);
8557 vl->confirmed = GNUNET_YES; 8625 vl->confirmed = GNUNET_YES;
8558 vl->message_uuid_ctr = 8626 vl->message_uuid_ctr =
8559 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); 8627 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
@@ -8654,10 +8722,11 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc)
8654 vl = lookup_virtual_link (&cmc->im.sender); 8722 vl = lookup_virtual_link (&cmc->im.sender);
8655 if (NULL == vl) 8723 if (NULL == vl)
8656 { 8724 {
8725 vl = GNUNET_new (struct VirtualLink);
8657 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 8726 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8658 "No virtual link for FC creating new unconfirmed virtual link to %s!\n", 8727 "No virtual link for %p FC creating new unconfirmed virtual link to %s!\n",
8728 vl,
8659 GNUNET_i2s (&cmc->im.sender)); 8729 GNUNET_i2s (&cmc->im.sender));
8660 vl = GNUNET_new (struct VirtualLink);
8661 vl->confirmed = GNUNET_NO; 8730 vl->confirmed = GNUNET_NO;
8662 vl->message_uuid_ctr = 8731 vl->message_uuid_ctr =
8663 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); 8732 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
@@ -8973,6 +9042,12 @@ fragment_message (struct Queue *queue,
8973 frag = 9042 frag =
8974 GNUNET_malloc (sizeof(struct PendingMessage) 9043 GNUNET_malloc (sizeof(struct PendingMessage)
8975 + sizeof(struct TransportFragmentBoxMessage) + fragsize); 9044 + sizeof(struct TransportFragmentBoxMessage) + fragsize);
9045 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9046 "3 created pm %p from pm %p storing vl %p from pm %p\n",
9047 frag,
9048 ff,
9049 pm->vl,
9050 pm);
8976 frag->logging_uuid = logging_uuid_gen++; 9051 frag->logging_uuid = logging_uuid_gen++;
8977 frag->vl = pm->vl; 9052 frag->vl = pm->vl;
8978 frag->frag_parent = ff; 9053 frag->frag_parent = ff;
@@ -9037,7 +9112,11 @@ reliability_box_message (struct Queue *queue,
9037 do nothing */ 9112 do nothing */
9038 if (NULL != pm->bpm) 9113 if (NULL != pm->bpm)
9039 return pm->bpm; /* already computed earlier: do nothing */ 9114 return pm->bpm; /* already computed earlier: do nothing */
9040 GNUNET_assert (NULL == pm->head_frag); 9115 // TODO I guess we do not need this assertion. We might have a DLL with
9116 // fragments, because the MTU changed, and we do not need to fragment anymore.
9117 // But we should keep the fragments until message was completed, because
9118 // the MTU might change again.
9119 // GNUNET_assert (NULL == pm->head_frag);
9041 if (pm->bytes_msg + sizeof(rbox) > UINT16_MAX) 9120 if (pm->bytes_msg + sizeof(rbox) > UINT16_MAX)
9042 { 9121 {
9043 /* failed hard */ 9122 /* failed hard */
@@ -9050,6 +9129,11 @@ reliability_box_message (struct Queue *queue,
9050 9129
9051 bpm = GNUNET_malloc (sizeof(struct PendingMessage) + sizeof(rbox) 9130 bpm = GNUNET_malloc (sizeof(struct PendingMessage) + sizeof(rbox)
9052 + pm->bytes_msg); 9131 + pm->bytes_msg);
9132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9133 "4 created pm %p storing vl %p from pm %p\n",
9134 bpm,
9135 pm->vl,
9136 pm);
9053 bpm->logging_uuid = logging_uuid_gen++; 9137 bpm->logging_uuid = logging_uuid_gen++;
9054 bpm->vl = pm->vl; 9138 bpm->vl = pm->vl;
9055 bpm->frag_parent = pm; 9139 bpm->frag_parent = pm;
@@ -9255,6 +9339,8 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
9255 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9256 "too early for all messages, they are sorted by next_attempt\n"); 9340 "too early for all messages, they are sorted by next_attempt\n");
9257 sc->to_early = GNUNET_YES; 9341 sc->to_early = GNUNET_YES;
9342 sc->to_early_retry_delay = GNUNET_TIME_absolute_get_remaining (
9343 pos->next_attempt);
9258 9344
9259 break; /* too early for all messages, they are sorted by next_attempt */ 9345 break; /* too early for all messages, they are sorted by next_attempt */
9260 } 9346 }
@@ -9312,9 +9398,12 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
9312 relb = GNUNET_YES; 9398 relb = GNUNET_YES;
9313 } 9399 }
9314 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9315 "Create reliability box of msg with size %u, realoverhead is %u\n", 9401 "Create reliability box of msg with size %u, realoverhead is %u %u %u %u\n",
9316 pos->bytes_msg, 9402 pos->bytes_msg,
9317 real_overhead); 9403 real_overhead,
9404 queue->mtu,
9405 frag,
9406 relb);
9318 } 9407 }
9319 9408
9320 /* Finally, compare to existing 'best' in sc to see if this 'pos' pending 9409 /* Finally, compare to existing 'best' in sc to see if this 'pos' pending
@@ -9397,6 +9486,11 @@ extract_box_cb (void *cls,
9397 9486
9398 GNUNET_assert (NULL == pm->bpm); 9487 GNUNET_assert (NULL == pm->bpm);
9399 bpm = GNUNET_malloc (sizeof(struct PendingMessage) + bsize); 9488 bpm = GNUNET_malloc (sizeof(struct PendingMessage) + bsize);
9489 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9490 "5 created pm %p storing vl %p from pm %p\n",
9491 bpm,
9492 pm->vl,
9493 pm);
9400 bpm->logging_uuid = logging_uuid_gen++; 9494 bpm->logging_uuid = logging_uuid_gen++;
9401 bpm->pmt = PMT_DV_BOX; 9495 bpm->pmt = PMT_DV_BOX;
9402 bpm->vl = pm->vl; 9496 bpm->vl = pm->vl;
@@ -9484,43 +9578,45 @@ transmit_on_queue (void *cls)
9484 9578
9485 /* Given selection in `sc`, do transmission */ 9579 /* Given selection in `sc`, do transmission */
9486 pm = sc.best; 9580 pm = sc.best;
9581 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9582 "Selected message <%llu>\n",
9583 pm->logging_uuid);
9487 if (NULL != sc.dvh) 9584 if (NULL != sc.dvh)
9488 { 9585 {
9489 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9586 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9490 "Is this %u a DV box?\n", 9587 "Is this %u a DV box?\n",
9491 pm->pmt); 9588 pm->pmt);
9492 GNUNET_assert (PMT_DV_BOX != pm->pmt); 9589 GNUNET_assert (PMT_DV_BOX != pm->pmt);
9493 if (NULL != sc.best->bpm) 9590 if ((NULL != sc.best->bpm) && (sc.best->bpm->used_dvh != sc.dvh))
9494 { 9591 {
9495 const struct DVPathEntryP *hops_old;
9496 const struct DVPathEntryP *hops_selected;
9497
9498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9592 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9499 "Discard old box\n"); 9593 "Discard old box, because we have a new DV path.\n");
9500 /* We did this boxing before, but possibly for a different path!
9501 Discard old DV box! OPTIMIZE-ME: we might want to check if
9502 it is the same and then not re-build the message... */
9503 free_pending_message (sc.best->bpm); 9594 free_pending_message (sc.best->bpm);
9504 sc.best->bpm = NULL; 9595 sc.best->bpm = NULL;
9505 } 9596 }
9506 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9597
9507 "encapsulate_for_dv 2\n"); 9598 if (NULL == sc.best->bpm)
9508 encapsulate_for_dv (sc.dvh->dv, 9599 {
9509 1, 9600 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9510 &sc.dvh, 9601 "encapsulate_for_dv 2\n");
9511 (const struct GNUNET_MessageHeader *) &sc.best[1], 9602 encapsulate_for_dv (sc.dvh->dv,
9512 &extract_box_cb, 9603 1,
9513 &sc, 9604 &sc.dvh,
9514 RMO_NONE, 9605 (const struct GNUNET_MessageHeader *) &sc.best[1],
9515 GNUNET_NO); 9606 &extract_box_cb,
9516 GNUNET_assert (NULL != sc.best->bpm); 9607 &sc,
9517 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9608 RMO_NONE,
9518 "%u %u %u %u %u\n", 9609 GNUNET_NO);
9519 sizeof(struct GNUNET_PeerIdentity), 9610 GNUNET_assert (NULL != sc.best->bpm);
9520 sizeof(struct TransportDVBoxMessage), 9611 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9521 sizeof(struct TransportDVBoxPayloadP), 9612 "%u %u %u %u %u\n",
9522 sizeof(struct TransportFragmentBoxMessage), 9613 sizeof(struct GNUNET_PeerIdentity),
9523 ((const struct GNUNET_MessageHeader *) &sc.best[1])->size); 9614 sizeof(struct TransportDVBoxMessage),
9615 sizeof(struct TransportDVBoxPayloadP),
9616 sizeof(struct TransportFragmentBoxMessage),
9617 ((const struct GNUNET_MessageHeader *) &sc.best[1])->size);
9618 sc.best->bpm->used_dvh = sc.dvh;
9619 }
9524 pm = sc.best->bpm; 9620 pm = sc.best->bpm;
9525 } 9621 }
9526 if (GNUNET_YES == sc.frag) 9622 if (GNUNET_YES == sc.frag)
@@ -9722,13 +9818,13 @@ handle_send_message_ack (void *cls,
9722 for (struct QueueEntry *qep = queue->queue_head; NULL != qep; 9818 for (struct QueueEntry *qep = queue->queue_head; NULL != qep;
9723 qep = qep->next) 9819 qep = qep->next)
9724 { 9820 {
9821 if (qep->mid != sma->mid)
9822 continue;
9725 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9823 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9726 "QueueEntry MID: %llu on queue QID: %llu, Ack MID: %llu\n", 9824 "QueueEntry MID: %llu on queue QID: %llu, Ack MID: %llu\n",
9727 (unsigned long long) qep->mid, 9825 (unsigned long long) qep->mid,
9728 (unsigned long long) queue->qid, 9826 (unsigned long long) queue->qid,
9729 (unsigned long long) sma->mid); 9827 (unsigned long long) sma->mid);
9730 if (qep->mid != sma->mid)
9731 continue;
9732 qe = qep; 9828 qe = qep;
9733 if ((NULL != qe->pm)&&(qe->pm->qe != qe)) 9829 if ((NULL != qe->pm)&&(qe->pm->qe != qe))
9734 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9830 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -9739,9 +9835,13 @@ handle_send_message_ack (void *cls,
9739 } 9835 }
9740 if (NULL == qe) 9836 if (NULL == qe)
9741 { 9837 {
9838 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9839 "No QueueEntry found for Ack MID %llu\n",
9840 (unsigned long long) sma->mid);
9841 // TODO I guess this can happen, if the Ack from the peer comes before the Ack from the queue.
9742 /* this should never happen */ 9842 /* this should never happen */
9743 GNUNET_break (0); 9843 /*GNUNET_break (0);
9744 GNUNET_SERVICE_client_drop (tc->client); 9844 GNUNET_SERVICE_client_drop (tc->client);*/
9745 return; 9845 return;
9746 } 9846 }
9747 GNUNET_CONTAINER_DLL_remove (qe->queue->queue_head, 9847 GNUNET_CONTAINER_DLL_remove (qe->queue->queue_head,
@@ -9790,6 +9890,7 @@ handle_send_message_ack (void *cls,
9790 } 9890 }
9791 else if (1 == qe->queue->q_capacity) 9891 else if (1 == qe->queue->q_capacity)
9792 { 9892 {
9893 // TODO I guess this will never happen, because the communicator triggers this by updating its queue length itself.
9793 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9894 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9794 "Transmission rescheduled due to communicator message queue with qid %u has capacity %lu.\n", 9895 "Transmission rescheduled due to communicator message queue with qid %u has capacity %lu.\n",
9795 qe->queue->qid, 9896 qe->queue->qid,
@@ -9814,9 +9915,14 @@ handle_send_message_ack (void *cls,
9814 /* If waiting for this communicator may have blocked transmission 9915 /* If waiting for this communicator may have blocked transmission
9815 of pm on other queues for this neighbour, force schedule 9916 of pm on other queues for this neighbour, force schedule
9816 transmit on queue for queues of the neighbour */ 9917 transmit on queue for queues of the neighbour */
9817 vl = pm->vl; 9918 if (NULL == pm->frag_parent)
9818 if (vl->pending_msg_head == pm) 9919 {
9819 check_vl_transmission (vl); 9920 vl = pm->vl;
9921 if ((NULL != vl) &&
9922 (NULL != vl->pending_msg_head) &&
9923 (vl->pending_msg_head == pm))
9924 check_vl_transmission (vl);
9925 }
9820 } 9926 }
9821 GNUNET_free (qe); 9927 GNUNET_free (qe);
9822} 9928}
@@ -10350,11 +10456,12 @@ handle_add_queue_message (void *cls,
10350 addr_len = ntohs (aqm->header.size) - sizeof(*aqm); 10456 addr_len = ntohs (aqm->header.size) - sizeof(*aqm);
10351 addr = (const char *) &aqm[1]; 10457 addr = (const char *) &aqm[1];
10352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 10458 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
10353 "New queue %s to %s available with QID %llu and q_len %lu \n", 10459 "New queue %s to %s available with QID %llu and q_len %lu and mtu %u\n",
10354 addr, 10460 addr,
10355 GNUNET_i2s (&aqm->receiver), 10461 GNUNET_i2s (&aqm->receiver),
10356 (unsigned long long) aqm->qid, 10462 (unsigned long long) aqm->qid,
10357 GNUNET_ntohll (aqm->q_len)); 10463 GNUNET_ntohll (aqm->q_len),
10464 ntohl (aqm->mtu));
10358 queue = GNUNET_malloc (sizeof(struct Queue) + addr_len); 10465 queue = GNUNET_malloc (sizeof(struct Queue) + addr_len);
10359 queue->tc = tc; 10466 queue->tc = tc;
10360 queue->address = (const char *) &queue[1]; 10467 queue->address = (const char *) &queue[1];
@@ -10416,8 +10523,10 @@ handle_update_queue_message (void *cls,
10416 struct Queue *target_queue = NULL; 10523 struct Queue *target_queue = NULL;
10417 10524
10418 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 10525 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
10419 "Received queue update message for %u with q_len %llu\n", 10526 "Received queue update message for %u with q_len %llu and mtu %u\n",
10420 msg->qid, (unsigned long long) GNUNET_ntohll (msg->q_len)); 10527 msg->qid,
10528 (unsigned long long) GNUNET_ntohll (msg->q_len),
10529 ntohl (msg->mtu));
10421 for (target_queue = tc->details.communicator.queue_head; 10530 for (target_queue = tc->details.communicator.queue_head;
10422 NULL != target_queue; 10531 NULL != target_queue;
10423 target_queue = target_queue->next_client) 10532 target_queue = target_queue->next_client)
@@ -10444,6 +10553,10 @@ handle_update_queue_message (void *cls,
10444 else 10553 else
10445 target_queue->unlimited_length = GNUNET_NO; 10554 target_queue->unlimited_length = GNUNET_NO;
10446 target_queue->q_capacity = GNUNET_ntohll (msg->q_len); 10555 target_queue->q_capacity = GNUNET_ntohll (msg->q_len);
10556 if (0 < target_queue->q_capacity)
10557 schedule_transmit_on_queue (GNUNET_TIME_UNIT_ZERO,
10558 target_queue,
10559 GNUNET_SCHEDULER_PRIORITY_DEFAULT);
10447 GNUNET_SERVICE_client_continue (tc->client); 10560 GNUNET_SERVICE_client_continue (tc->client);
10448} 10561}
10449 10562
@@ -10772,6 +10885,7 @@ free_ack_cummulator_cb (void *cls,
10772 10885
10773 (void) cls; 10886 (void) cls;
10774 (void) pid; 10887 (void) pid;
10888 GNUNET_SCHEDULER_cancel (ac->task);
10775 GNUNET_free (ac); 10889 GNUNET_free (ac);
10776 return GNUNET_OK; 10890 return GNUNET_OK;
10777} 10891}
diff --git a/src/transport/test_transport_api2_tcp_node1.conf b/src/transport/test_transport_api2_tcp_node1.conf
index e38744949..b8a743a3b 100644
--- a/src/transport/test_transport_api2_tcp_node1.conf
+++ b/src/transport/test_transport_api2_tcp_node1.conf
@@ -5,7 +5,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
5[transport] 5[transport]
6BINARY = gnunet-service-tng 6BINARY = gnunet-service-tng
7PLUGINS = tcp 7PLUGINS = tcp
8# PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/vg_peer1-%p 8#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_peer1-%p
9UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock 9UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock
10 10
11[communicator-tcp] 11[communicator-tcp]
@@ -14,10 +14,11 @@ BINDTO = 192.168.15.1:60002
14DISABLE_V6 = YES 14DISABLE_V6 = YES
15IMMEDIATE_START = YES 15IMMEDIATE_START = YES
16UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock 16UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock
17#PREFIX = valgrind --log-file=/tmp/vg_cpeer1-%p 17#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_ctpeer1-%p
18#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args 18#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
19 19
20[communicator-udp] 20[communicator-udp]
21#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_cupeer1-%p
21BINARY = gnunet-communicator-udp 22BINARY = gnunet-communicator-udp
22BINDTO = 192.168.15.1:60002 23BINDTO = 192.168.15.1:60002
23DISABLE_V6 = YES 24DISABLE_V6 = YES
diff --git a/src/transport/test_transport_start_with_config.c b/src/transport/test_transport_start_with_config.c
index 4705eb9b2..0c3271436 100644
--- a/src/transport/test_transport_start_with_config.c
+++ b/src/transport/test_transport_start_with_config.c
@@ -29,7 +29,7 @@
29#include "transport-testing-cmds.h" 29#include "transport-testing-cmds.h"
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31 31
32#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300) 32#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
33 33
34 34
35int 35int