diff options
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-communicator-udp.c | 131 | ||||
-rw-r--r-- | src/transport/test_communicator_basic.c | 38 | ||||
-rw-r--r-- | src/transport/test_communicator_udp_backchannel_peer1.conf | 2 | ||||
-rw-r--r-- | src/transport/test_communicator_udp_backchannel_peer2.conf | 2 | ||||
-rw-r--r-- | src/transport/test_communicator_udp_basic_peer1.conf | 1 | ||||
-rw-r--r-- | src/transport/transport-testing-communicator.c | 25 | ||||
-rw-r--r-- | src/transport/transport-testing-communicator.h | 10 |
7 files changed, 128 insertions, 81 deletions
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index 75f732d6c..2b014f890 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -37,8 +37,8 @@ | |||
37 | * - support NAT connection reversal method (#5529) | 37 | * - support NAT connection reversal method (#5529) |
38 | * - support other UDP-specific NAT traversal methods (#) | 38 | * - support other UDP-specific NAT traversal methods (#) |
39 | */ | 39 | */ |
40 | #include "gnunet_common.h" | ||
41 | #include "platform.h" | 40 | #include "platform.h" |
41 | #include "gnunet_common.h" | ||
42 | #include "gnunet_util_lib.h" | 42 | #include "gnunet_util_lib.h" |
43 | #include "gnunet_protocols.h" | 43 | #include "gnunet_protocols.h" |
44 | #include "gnunet_signatures.h" | 44 | #include "gnunet_signatures.h" |
@@ -94,7 +94,7 @@ | |||
94 | */ | 94 | */ |
95 | #define GCM_TAG_SIZE (128 / 8) | 95 | #define GCM_TAG_SIZE (128 / 8) |
96 | 96 | ||
97 | #define GENERATE_AT_ONCE 2 | 97 | #define GENERATE_AT_ONCE 16 |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * If we fall below this number of available KCNs, | 100 | * If we fall below this number of available KCNs, |
@@ -105,7 +105,7 @@ | |||
105 | * arrive before the sender runs out. So really this | 105 | * arrive before the sender runs out. So really this |
106 | * should ideally be based on the RTT. | 106 | * should ideally be based on the RTT. |
107 | */ | 107 | */ |
108 | #define KCN_THRESHOLD 92 | 108 | #define KCN_THRESHOLD 96 |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * How many KCNs do we keep around *after* we hit | 111 | * How many KCNs do we keep around *after* we hit |
@@ -484,20 +484,7 @@ struct SharedSecret | |||
484 | */ | 484 | */ |
485 | int rekey_initiated; | 485 | int rekey_initiated; |
486 | 486 | ||
487 | /** | ||
488 | * ID of kce working queue task | ||
489 | */ | ||
490 | struct GNUNET_SCHEDULER_Task *kce_task; | ||
491 | 487 | ||
492 | /** | ||
493 | * Is the kce_task finished? | ||
494 | */ | ||
495 | int kce_task_finished; | ||
496 | |||
497 | /** | ||
498 | * When KCE finishes, send ACK if GNUNET_YES | ||
499 | */ | ||
500 | int kce_send_ack_on_finish; | ||
501 | }; | 488 | }; |
502 | 489 | ||
503 | 490 | ||
@@ -563,6 +550,20 @@ struct SenderAddress | |||
563 | */ | 550 | */ |
564 | int sender_destroy_called; | 551 | int sender_destroy_called; |
565 | 552 | ||
553 | /** | ||
554 | * ID of kce working queue task | ||
555 | */ | ||
556 | struct GNUNET_SCHEDULER_Task *kce_task; | ||
557 | |||
558 | /** | ||
559 | * Is the kce_task finished? | ||
560 | */ | ||
561 | int kce_task_finished; | ||
562 | |||
563 | /** | ||
564 | * When KCE finishes, send ACK if GNUNET_YES | ||
565 | */ | ||
566 | int kce_send_ack_on_finish; | ||
566 | }; | 567 | }; |
567 | 568 | ||
568 | 569 | ||
@@ -1030,10 +1031,10 @@ secret_destroy (struct SharedSecret *ss, int withoutKce) | |||
1030 | "# KIDs active", | 1031 | "# KIDs active", |
1031 | GNUNET_CONTAINER_multishortmap_size (key_cache), | 1032 | GNUNET_CONTAINER_multishortmap_size (key_cache), |
1032 | GNUNET_NO); | 1033 | GNUNET_NO); |
1033 | if (NULL != ss->kce_task) | 1034 | if (NULL != ss->sender->kce_task) |
1034 | { | 1035 | { |
1035 | GNUNET_SCHEDULER_cancel (ss->kce_task); | 1036 | GNUNET_SCHEDULER_cancel (ss->sender->kce_task); |
1036 | ss->kce_task = NULL; | 1037 | ss->sender->kce_task = NULL; |
1037 | } | 1038 | } |
1038 | GNUNET_free (ss); | 1039 | GNUNET_free (ss); |
1039 | return GNUNET_YES; | 1040 | return GNUNET_YES; |
@@ -1452,7 +1453,7 @@ add_acks (struct SharedSecret *ss, int acks_to_add) | |||
1452 | 1); | 1453 | 1); |
1453 | } | 1454 | } |
1454 | 1455 | ||
1455 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1456 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1456 | "Tell transport we have %u more acks!\n", | 1457 | "Tell transport we have %u more acks!\n", |
1457 | acks_to_add); | 1458 | acks_to_add); |
1458 | 1459 | ||
@@ -1501,25 +1502,25 @@ handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) | |||
1501 | 1502 | ||
1502 | if (allowed <= ss->sequence_allowed) | 1503 | if (allowed <= ss->sequence_allowed) |
1503 | { | 1504 | { |
1504 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1505 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1505 | "Ignoring ack, not giving us increased window\n."); | 1506 | "Ignoring ack, not giving us increased window\n."); |
1506 | return GNUNET_NO; | 1507 | return GNUNET_NO; |
1507 | } | 1508 | } |
1508 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1509 | "New sequence allows until %u from %u. Acks available to us: %u. For secret %s\n", | ||
1510 | allowed, | ||
1511 | ss->sequence_allowed, | ||
1512 | receiver->acks_available, | ||
1513 | GNUNET_h2s (&ss->master)); | ||
1514 | acks_to_add = (allowed - ss->sequence_allowed); | 1509 | acks_to_add = (allowed - ss->sequence_allowed); |
1515 | GNUNET_assert (0 != acks_to_add); | 1510 | GNUNET_assert (0 != acks_to_add); |
1516 | receiver->acks_available += (allowed - ss->sequence_allowed); | 1511 | receiver->acks_available += (allowed - ss->sequence_allowed); |
1517 | ss->sequence_allowed = allowed; | 1512 | ss->sequence_allowed = allowed; |
1518 | add_acks (ss, acks_to_add); | 1513 | add_acks (ss, acks_to_add); |
1514 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1515 | "New sequence allows until %u (+%u). Acks available to us: %u. For secret %s\n", | ||
1516 | allowed, | ||
1517 | acks_to_add, | ||
1518 | receiver->acks_available, | ||
1519 | GNUNET_h2s (&ss->master)); | ||
1519 | return GNUNET_NO; | 1520 | return GNUNET_NO; |
1520 | } | 1521 | } |
1521 | } | 1522 | } |
1522 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1523 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1523 | "Matching cmac not found for ack!\n"); | 1524 | "Matching cmac not found for ack!\n"); |
1524 | return GNUNET_YES; | 1525 | return GNUNET_YES; |
1525 | } | 1526 | } |
@@ -1556,7 +1557,7 @@ consider_ss_ack (struct SharedSecret *ss) | |||
1556 | ack.header.size = htons (sizeof(ack)); | 1557 | ack.header.size = htons (sizeof(ack)); |
1557 | ack.sequence_ack = htonl (ss->sequence_allowed); | 1558 | ack.sequence_ack = htonl (ss->sequence_allowed); |
1558 | ack.cmac = ss->cmac; | 1559 | ack.cmac = ss->cmac; |
1559 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1560 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1560 | "Notifying transport with UDPAck %s, sequence %u and master %s\n", | 1561 | "Notifying transport with UDPAck %s, sequence %u and master %s\n", |
1561 | GNUNET_i2s_full (&ss->sender->target), | 1562 | GNUNET_i2s_full (&ss->sender->target), |
1562 | ss->sequence_allowed, | 1563 | ss->sequence_allowed, |
@@ -1572,30 +1573,40 @@ static void | |||
1572 | kce_generate_cb (void *cls) | 1573 | kce_generate_cb (void *cls) |
1573 | { | 1574 | { |
1574 | struct SharedSecret *ss = cls; | 1575 | struct SharedSecret *ss = cls; |
1575 | 1576 | static uint64_t kce_last_available = 0; | |
1576 | ss->kce_task = NULL; | 1577 | ss->sender->kce_task = NULL; |
1577 | 1578 | ||
1578 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1579 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1579 | "Precomputing %u keys for master %s\n", | 1580 | "Precomputing %u keys for master %s\n", |
1580 | GENERATE_AT_ONCE, | 1581 | GENERATE_AT_ONCE, |
1581 | GNUNET_h2s (&(ss->master))); | 1582 | GNUNET_h2s (&(ss->master))); |
1582 | if (KCN_TARGET < ss->sender->acks_available) | 1583 | if (KCN_TARGET < ss->sender->acks_available) |
1584 | { | ||
1585 | ss->sender->kce_task = GNUNET_SCHEDULER_add_delayed ( | ||
1586 | WORKING_QUEUE_INTERVALL, | ||
1587 | kce_generate_cb, | ||
1588 | ss); | ||
1583 | return; | 1589 | return; |
1590 | } | ||
1584 | for (int i = 0; i < GENERATE_AT_ONCE; i++) | 1591 | for (int i = 0; i < GENERATE_AT_ONCE; i++) |
1585 | kce_generate (ss, ++ss->sequence_allowed); | 1592 | kce_generate (ss, ++ss->sequence_allowed); |
1586 | 1593 | ||
1594 | /** | ||
1595 | * As long as we loose over 30% of max acks in reschedule, | ||
1596 | * We keep generating acks for this ss. | ||
1597 | */ | ||
1587 | if (KCN_TARGET > ss->sender->acks_available) | 1598 | if (KCN_TARGET > ss->sender->acks_available) |
1588 | { | 1599 | { |
1589 | ss->kce_task = GNUNET_SCHEDULER_add_delayed ( | 1600 | ss->sender->kce_task = GNUNET_SCHEDULER_add_delayed ( |
1590 | WORKING_QUEUE_INTERVALL, | 1601 | WORKING_QUEUE_INTERVALL, |
1591 | kce_generate_cb, | 1602 | kce_generate_cb, |
1592 | ss); | 1603 | ss); |
1593 | return; | 1604 | return; |
1594 | } | 1605 | } |
1595 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1606 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1596 | "We have enough keys.\n"); | 1607 | "We have enough keys (ACKs: %u).\n", ss->sender->acks_available); |
1597 | ss->kce_task_finished = GNUNET_YES; | 1608 | ss->sender->kce_task_finished = GNUNET_YES; |
1598 | if (ss->kce_send_ack_on_finish == GNUNET_YES) | 1609 | if (ss->sender->kce_send_ack_on_finish == GNUNET_YES) |
1599 | consider_ss_ack (ss); | 1610 | consider_ss_ack (ss); |
1600 | } | 1611 | } |
1601 | 1612 | ||
@@ -1660,8 +1671,9 @@ try_handle_plaintext (struct SenderAddress *sender, | |||
1660 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1671 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1661 | "We have %u acks available.\n", | 1672 | "We have %u acks available.\n", |
1662 | ss_rekey->sender->acks_available); | 1673 | ss_rekey->sender->acks_available); |
1663 | ss_rekey->kce_send_ack_on_finish = GNUNET_NO; | 1674 | ss_rekey->sender->kce_send_ack_on_finish = GNUNET_NO; |
1664 | ss_rekey->kce_task = GNUNET_SCHEDULER_add_delayed ( | 1675 | // FIXME |
1676 | ss_rekey->sender->kce_task = GNUNET_SCHEDULER_add_delayed ( | ||
1665 | WORKING_QUEUE_INTERVALL, | 1677 | WORKING_QUEUE_INTERVALL, |
1666 | kce_generate_cb, | 1678 | kce_generate_cb, |
1667 | ss_rekey); | 1679 | ss_rekey); |
@@ -1718,7 +1730,7 @@ decrypt_box (const struct UDPBox *box, | |||
1718 | sizeof(out_buf), | 1730 | sizeof(out_buf), |
1719 | out_buf)) | 1731 | out_buf)) |
1720 | { | 1732 | { |
1721 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed decryption.\n"); | 1733 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed decryption.\n"); |
1722 | GNUNET_STATISTICS_update (stats, | 1734 | GNUNET_STATISTICS_update (stats, |
1723 | "# Decryption failures with valid KCE", | 1735 | "# Decryption failures with valid KCE", |
1724 | 1, | 1736 | 1, |
@@ -1727,6 +1739,7 @@ decrypt_box (const struct UDPBox *box, | |||
1727 | return; | 1739 | return; |
1728 | } | 1740 | } |
1729 | kce_destroy (kce); | 1741 | kce_destroy (kce); |
1742 | kce = NULL; | ||
1730 | GNUNET_STATISTICS_update (stats, | 1743 | GNUNET_STATISTICS_update (stats, |
1731 | "# bytes decrypted with BOX", | 1744 | "# bytes decrypted with BOX", |
1732 | sizeof(out_buf), | 1745 | sizeof(out_buf), |
@@ -1739,6 +1752,18 @@ decrypt_box (const struct UDPBox *box, | |||
1739 | "decrypted UDPBox with kid %s\n", | 1752 | "decrypted UDPBox with kid %s\n", |
1740 | GNUNET_sh2s (&box->kid)); | 1753 | GNUNET_sh2s (&box->kid)); |
1741 | try_handle_plaintext (ss->sender, out_buf, sizeof(out_buf)); | 1754 | try_handle_plaintext (ss->sender, out_buf, sizeof(out_buf)); |
1755 | if ((KCN_THRESHOLD > ss->sender->acks_available) && | ||
1756 | (NULL == ss->sender->kce_task) && | ||
1757 | (GNUNET_YES == ss->sender->kce_task_finished)) | ||
1758 | { | ||
1759 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1760 | "Sender has %u ack left which is under threshold.\n", | ||
1761 | ss->sender->acks_available); | ||
1762 | ss->sender->kce_send_ack_on_finish = GNUNET_YES; | ||
1763 | ss->sender->kce_task = GNUNET_SCHEDULER_add_now ( | ||
1764 | kce_generate_cb, | ||
1765 | ss); | ||
1766 | } | ||
1742 | } | 1767 | } |
1743 | 1768 | ||
1744 | 1769 | ||
@@ -1960,19 +1985,6 @@ sock_read (void *cls) | |||
1960 | "Found KCE with kid %s\n", | 1985 | "Found KCE with kid %s\n", |
1961 | GNUNET_sh2s (&box->kid)); | 1986 | GNUNET_sh2s (&box->kid)); |
1962 | decrypt_box (box, (size_t) rcvd, kce); | 1987 | decrypt_box (box, (size_t) rcvd, kce); |
1963 | if ((NULL == kce->ss->kce_task) && | ||
1964 | (GNUNET_YES == kce->ss->kce_task_finished) && | ||
1965 | (kce->ss->sender->acks_available < KCN_THRESHOLD)) | ||
1966 | { | ||
1967 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1968 | "Sender has %u ack left which is under threshold.\n", | ||
1969 | kce->ss->sender->acks_available); | ||
1970 | kce->ss->kce_send_ack_on_finish = GNUNET_YES; | ||
1971 | kce->ss->kce_task = GNUNET_SCHEDULER_add_delayed ( | ||
1972 | WORKING_QUEUE_INTERVALL, | ||
1973 | kce_generate_cb, | ||
1974 | kce->ss); | ||
1975 | } | ||
1976 | continue; | 1988 | continue; |
1977 | } | 1989 | } |
1978 | } | 1990 | } |
@@ -2107,13 +2119,13 @@ sock_read (void *cls) | |||
2107 | sender = setup_sender (&uc->sender, (const struct sockaddr *) &sa, salen); | 2119 | sender = setup_sender (&uc->sender, (const struct sockaddr *) &sa, salen); |
2108 | ss->sender = sender; | 2120 | ss->sender = sender; |
2109 | GNUNET_CONTAINER_DLL_insert (sender->ss_head, sender->ss_tail, ss); | 2121 | GNUNET_CONTAINER_DLL_insert (sender->ss_head, sender->ss_tail, ss); |
2110 | if ((NULL == ss->kce_task) && (GNUNET_NO == | 2122 | if ((KCN_THRESHOLD > ss->sender->acks_available) && |
2111 | ss->kce_task_finished)) | 2123 | (NULL == ss->sender->kce_task) && |
2124 | (GNUNET_NO == ss->sender->kce_task_finished)) | ||
2112 | { | 2125 | { |
2113 | // TODO This task must be per sender! FIXME: This is a nice todo, but I do not know what must be done here to fix. | 2126 | // TODO This task must be per sender! FIXME: This is a nice todo, but I do not know what must be done here to fix. |
2114 | ss->kce_send_ack_on_finish = GNUNET_YES; | 2127 | ss->sender->kce_send_ack_on_finish = GNUNET_YES; |
2115 | ss->kce_task = GNUNET_SCHEDULER_add_delayed ( | 2128 | ss->sender->kce_task = GNUNET_SCHEDULER_add_now ( |
2116 | WORKING_QUEUE_INTERVALL, | ||
2117 | kce_generate_cb, | 2129 | kce_generate_cb, |
2118 | ss); | 2130 | ss); |
2119 | } | 2131 | } |
@@ -2600,13 +2612,14 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2600 | msize, | 2612 | msize, |
2601 | receiver->acks_available); | 2613 | receiver->acks_available); |
2602 | ss->bytes_sent += sizeof (dgram); | 2614 | ss->bytes_sent += sizeof (dgram); |
2603 | GNUNET_MQ_impl_send_continue (mq); | ||
2604 | receiver->acks_available--; | 2615 | receiver->acks_available--; |
2616 | GNUNET_MQ_impl_send_continue (mq); | ||
2605 | return; | 2617 | return; |
2606 | } | 2618 | } |
2607 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2619 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2608 | "No suitable ss found, sending as KX...\n"); | 2620 | "No suitable ss found, sending as KX...\n"); |
2609 | send_msg_with_kx (msg, receiver); | 2621 | send_msg_with_kx (msg, receiver); |
2622 | GNUNET_MQ_impl_send_continue (mq); | ||
2610 | } | 2623 | } |
2611 | 2624 | ||
2612 | 2625 | ||
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c index 975a0a837..bba8025af 100644 --- a/src/transport/test_communicator_basic.c +++ b/src/transport/test_communicator_basic.c | |||
@@ -91,7 +91,7 @@ static struct GNUNET_STATISTICS_GetHandle *rekey_stats[NUM_PEERS]; | |||
91 | 91 | ||
92 | #define ALLOWED_PACKET_LOSS 91 | 92 | #define ALLOWED_PACKET_LOSS 91 |
93 | 93 | ||
94 | #define BURST_PACKETS 15000 | 94 | #define BURST_PACKETS 5000 |
95 | 95 | ||
96 | #define TOTAL_ITERATIONS 1 | 96 | #define TOTAL_ITERATIONS 1 |
97 | 97 | ||
@@ -394,7 +394,8 @@ process_statistics (void *cls, | |||
394 | { | 394 | { |
395 | ret = 2; | 395 | ret = 2; |
396 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 396 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
397 | "Not enough BOX messages!\n"); | 397 | "Not enough BOX messages! (want: %u, have %llu)\n", |
398 | 9000, value); | ||
398 | GNUNET_SCHEDULER_shutdown (); | 399 | GNUNET_SCHEDULER_shutdown (); |
399 | } | 400 | } |
400 | if ((0 == strcmp ("rekey", test_name)) && | 401 | if ((0 == strcmp ("rekey", test_name)) && |
@@ -433,11 +434,13 @@ short_test_cb (void *cls) | |||
433 | tc_h); | 434 | tc_h); |
434 | payload = make_payload (SHORT_MESSAGE_SIZE); | 435 | payload = make_payload (SHORT_MESSAGE_SIZE); |
435 | num_sent_short[peer_nr]++; | 436 | num_sent_short[peer_nr]++; |
437 | if (burst_packets_short == num_sent_short[peer_nr]) | ||
438 | tc_h->cont = NULL; | ||
439 | else | ||
440 | tc_h->cont = short_test; | ||
441 | tc_h->cont_cls = cls; | ||
436 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, | 442 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, |
437 | (burst_packets_short == | 443 | NULL, |
438 | num_sent_short[peer_nr]) | ||
439 | ? NULL | ||
440 | : &short_test, | ||
441 | cls, | 444 | cls, |
442 | payload, | 445 | payload, |
443 | SHORT_MESSAGE_SIZE); | 446 | SHORT_MESSAGE_SIZE); |
@@ -478,11 +481,13 @@ size_test (void *cls) | |||
478 | ack[peer_nr] += 10; | 481 | ack[peer_nr] += 10; |
479 | payload = make_payload (ack[peer_nr]); | 482 | payload = make_payload (ack[peer_nr]); |
480 | num_sent_size[peer_nr]++; | 483 | num_sent_size[peer_nr]++; |
484 | if (ack[peer_nr] >= max_size) | ||
485 | tc_h->cont = NULL; | ||
486 | else | ||
487 | tc_h->cont = size_test; | ||
488 | tc_h->cont_cls = cls; | ||
481 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, | 489 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, |
482 | (ack[peer_nr] < | 490 | NULL, |
483 | max_size) | ||
484 | ? &size_test | ||
485 | : NULL, | ||
486 | cls, | 491 | cls, |
487 | payload, | 492 | payload, |
488 | ack[peer_nr]); | 493 | ack[peer_nr]); |
@@ -512,11 +517,13 @@ long_test_cb (void *cls) | |||
512 | (unsigned int) num_received_long[peer_nr]); | 517 | (unsigned int) num_received_long[peer_nr]); |
513 | payload = make_payload (long_message_size); | 518 | payload = make_payload (long_message_size); |
514 | num_sent_long[peer_nr]++; | 519 | num_sent_long[peer_nr]++; |
520 | if (burst_packets_long == num_sent_long[peer_nr]) | ||
521 | tc_h->cont = NULL; | ||
522 | else | ||
523 | tc_h->cont = long_test; | ||
524 | tc_h->cont_cls = cls; | ||
515 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, | 525 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_h, |
516 | (burst_packets_long == | 526 | NULL, |
517 | num_sent_long[peer_nr]) | ||
518 | ? NULL | ||
519 | : &long_test, | ||
520 | cls, | 527 | cls, |
521 | payload, | 528 | payload, |
522 | long_message_size); | 529 | long_message_size); |
@@ -936,7 +943,8 @@ incoming_message_cb ( | |||
936 | if (long_message_size != payload_len) | 943 | if (long_message_size != payload_len) |
937 | { | 944 | { |
938 | LOG (GNUNET_ERROR_TYPE_WARNING, | 945 | LOG (GNUNET_ERROR_TYPE_WARNING, |
939 | "Ignoring packet with wrong length\n"); | 946 | "Ignoring packet with wrong length (have: %lu, want: %lu)\n", |
947 | payload_len, long_message_size); | ||
940 | return; // Ignore | 948 | return; // Ignore |
941 | } | 949 | } |
942 | num_received_long[peer_nr]++; | 950 | num_received_long[peer_nr]++; |
diff --git a/src/transport/test_communicator_udp_backchannel_peer1.conf b/src/transport/test_communicator_udp_backchannel_peer1.conf index 59e6d68e3..65f33bd6b 100644 --- a/src/transport/test_communicator_udp_backchannel_peer1.conf +++ b/src/transport/test_communicator_udp_backchannel_peer1.conf | |||
@@ -39,7 +39,7 @@ BINDTO = 60002 | |||
39 | DISABLE_V6 = YES | 39 | DISABLE_V6 = YES |
40 | 40 | ||
41 | [communicator-udp] | 41 | [communicator-udp] |
42 | #PREFIX = valgrind --leak-check=full --track-origins=yes | 42 | # PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/vg_comm1 |
43 | BINDTO = 60002 | 43 | BINDTO = 60002 |
44 | DISABLE_V6 = YES | 44 | DISABLE_V6 = YES |
45 | MAX_QUEUE_LENGTH=5000 | 45 | MAX_QUEUE_LENGTH=5000 |
diff --git a/src/transport/test_communicator_udp_backchannel_peer2.conf b/src/transport/test_communicator_udp_backchannel_peer2.conf index 3abf7999b..9875af724 100644 --- a/src/transport/test_communicator_udp_backchannel_peer2.conf +++ b/src/transport/test_communicator_udp_backchannel_peer2.conf | |||
@@ -39,7 +39,7 @@ BINDTO = 60003 | |||
39 | DISABLE_V6 = YES | 39 | DISABLE_V6 = YES |
40 | 40 | ||
41 | [communicator-udp] | 41 | [communicator-udp] |
42 | #PREFIX = valgrind --leak-check=full --track-origins=yes | 42 | # PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/vg_comm2 |
43 | BINDTO = 60003 | 43 | BINDTO = 60003 |
44 | DISABLE_V6 = YES | 44 | DISABLE_V6 = YES |
45 | MAX_QUEUE_LENGTH=5000 | 45 | MAX_QUEUE_LENGTH=5000 |
diff --git a/src/transport/test_communicator_udp_basic_peer1.conf b/src/transport/test_communicator_udp_basic_peer1.conf index c6ff024ee..ec8c19f62 100644 --- a/src/transport/test_communicator_udp_basic_peer1.conf +++ b/src/transport/test_communicator_udp_basic_peer1.conf | |||
@@ -36,3 +36,4 @@ UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock | |||
36 | BINDTO = 60002 | 36 | BINDTO = 60002 |
37 | DISABLE_V6 = YES | 37 | DISABLE_V6 = YES |
38 | MAX_QUEUE_LENGTH=5000 | 38 | MAX_QUEUE_LENGTH=5000 |
39 | |||
diff --git a/src/transport/transport-testing-communicator.c b/src/transport/transport-testing-communicator.c index d0e32a544..26895e457 100644 --- a/src/transport/transport-testing-communicator.c +++ b/src/transport/transport-testing-communicator.c | |||
@@ -260,7 +260,7 @@ handle_communicator_backchannel (void *cls, | |||
260 | } | 260 | } |
261 | /* Find client providing this communicator */ | 261 | /* Find client providing this communicator */ |
262 | /* Finally, deliver backchannel message to communicator */ | 262 | /* Finally, deliver backchannel message to communicator */ |
263 | LOG (GNUNET_ERROR_TYPE_ERROR, | 263 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
264 | "Delivering backchannel message of type %u to %s\n", | 264 | "Delivering backchannel message of type %u to %s\n", |
265 | ntohs (msg->type), | 265 | ntohs (msg->type), |
266 | target_communicator); | 266 | target_communicator); |
@@ -676,8 +676,13 @@ handle_send_message_ack (void *cls, | |||
676 | const struct GNUNET_TRANSPORT_SendMessageToAck *sma) | 676 | const struct GNUNET_TRANSPORT_SendMessageToAck *sma) |
677 | { | 677 | { |
678 | struct MyClient *client = cls; | 678 | struct MyClient *client = cls; |
679 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = | ||
680 | client->tc; | ||
681 | static int mtr = 0; | ||
682 | mtr++; | ||
683 | if (tc_h->cont != NULL) | ||
684 | tc_h->cont (tc_h->cont_cls); | ||
679 | GNUNET_SERVICE_client_continue (client->client); | 685 | GNUNET_SERVICE_client_continue (client->client); |
680 | // NOP | ||
681 | } | 686 | } |
682 | 687 | ||
683 | 688 | ||
@@ -1166,8 +1171,9 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send | |||
1166 | size_t inbox_size; | 1171 | size_t inbox_size; |
1167 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; | 1172 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; |
1168 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue_tmp; | 1173 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue_tmp; |
1169 | 1174 | static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *last_queue; | |
1170 | tc_queue = NULL; | 1175 | tc_queue = NULL; |
1176 | |||
1171 | for (tc_queue_tmp = tc_h->queue_head; | 1177 | for (tc_queue_tmp = tc_h->queue_head; |
1172 | NULL != tc_queue_tmp; | 1178 | NULL != tc_queue_tmp; |
1173 | tc_queue_tmp = tc_queue_tmp->next) | 1179 | tc_queue_tmp = tc_queue_tmp->next) |
@@ -1194,13 +1200,22 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send | |||
1194 | tc_queue = tc_queue_tmp; | 1200 | tc_queue = tc_queue_tmp; |
1195 | } | 1201 | } |
1196 | } | 1202 | } |
1203 | if (last_queue != tc_queue) | ||
1204 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1205 | "Selected sending queue changed to %u with length %lu and MTU %u\n", | ||
1206 | ntohl (tc_queue->qid), tc_queue->q_len, tc_queue->mtu); | ||
1197 | GNUNET_assert (NULL != tc_queue); | 1207 | GNUNET_assert (NULL != tc_queue); |
1208 | last_queue = tc_queue; | ||
1198 | // Uncomment this for alternativ 1 of backchannel functionality | 1209 | // Uncomment this for alternativ 1 of backchannel functionality |
1199 | if (tc_queue->q_len != GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED) | 1210 | if (tc_queue->q_len != GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED) |
1200 | tc_queue->q_len--; | 1211 | tc_queue->q_len--; |
1201 | // Until here for alternativ 1 | 1212 | // Until here for alternativ 1 |
1202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1213 | static int msg_count = 0; |
1203 | "Sending message\n"); | 1214 | msg_count++; |
1215 | if (msg_count % 100 == 0) | ||
1216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1217 | "Sending %u-th (%lu-th for queue) message on queue %u\n", | ||
1218 | msg_count, tc_queue->mid, ntohl (tc_queue->qid)); | ||
1204 | inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size; | 1219 | inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size; |
1205 | env = GNUNET_MQ_msg_extra (msg, | 1220 | env = GNUNET_MQ_msg_extra (msg, |
1206 | inbox_size, | 1221 | inbox_size, |
diff --git a/src/transport/transport-testing-communicator.h b/src/transport/transport-testing-communicator.h index 1875258b4..122ac3efa 100644 --- a/src/transport/transport-testing-communicator.h +++ b/src/transport/transport-testing-communicator.h | |||
@@ -282,6 +282,16 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle | |||
282 | void *cb_cls; | 282 | void *cb_cls; |
283 | 283 | ||
284 | /** | 284 | /** |
285 | * Callback to call when message ack received. | ||
286 | */ | ||
287 | GNUNET_SCHEDULER_TaskCallback cont; | ||
288 | |||
289 | /** | ||
290 | * Closure for cont | ||
291 | */ | ||
292 | void *cont_cls; | ||
293 | |||
294 | /** | ||
285 | * Backchannel supported | 295 | * Backchannel supported |
286 | */ | 296 | */ |
287 | int bc_enabled; | 297 | int bc_enabled; |