diff options
author | t3sserakt <t3ss@posteo.de> | 2021-10-07 13:07:30 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-10-07 13:07:30 +0200 |
commit | d7fa0579995790840199ec86cb4d518f9d372fcd (patch) | |
tree | b41accedea6cd0fb78d75afee61911b94a1099fb /src/transport/gnunet-communicator-udp.c | |
parent | 658bceab7ba3aab5121e8874d8508264d3f63ce3 (diff) | |
download | gnunet-d7fa0579995790840199ec86cb4d518f9d372fcd.tar.gz gnunet-d7fa0579995790840199ec86cb4d518f9d372fcd.zip |
- add generic topology configuration by file
- cmd simple send using file configuration from file
- added cmd to check the logs for backchannel encapsulation
- added cmd which notifies the master loop of local loop being prepared to finish
- added logging to helper.c
- moved code from connecting peers cmd into global functions
- added parameters given to the connecting peers cmd
- added assertion when notifying the transport service about a new queue, if the communicator has no intial capacity
- added optional valgrind cmd to test script
- added flag für queues with unlimited length
- added check for queues with higher priority
- added attribute queue_capacity to struct Queue
- bug fixing worker task for kce generation and transport notification about available queue in udp communicator
- change value for unlimited queue length from 0 to UINT16_MAX in tcp communicator and service
- added loop to stop the test system for the globally known peers in stop testsystem cmd
- refactored endless growing array to handle further messages from the local loops, and added logic to handle the local test prepare msg
- added utility methods in testing.c
- added forwarding of all tests prepared msg in gnunet-cmds-helper.c
- added cmd to end loop without shutdown
- added without shutdown cmd to simple send testcase
- added backchannel check, without shutdown and prepared cmd to udp backchannel testcase.
Diffstat (limited to 'src/transport/gnunet-communicator-udp.c')
-rw-r--r-- | src/transport/gnunet-communicator-udp.c | 101 |
1 files changed, 64 insertions, 37 deletions
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index ef7b1d6c0..659fd7d26 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -1494,7 +1494,27 @@ add_acks (struct SharedSecret *ss, int acks_to_add) | |||
1494 | 1494 | ||
1495 | GNUNET_assert (NULL != ss); | 1495 | GNUNET_assert (NULL != ss); |
1496 | GNUNET_assert (NULL != receiver); | 1496 | GNUNET_assert (NULL != receiver); |
1497 | GNUNET_assert (NULL != receiver->d_qh); | 1497 | |
1498 | if (NULL == receiver->d_qh) | ||
1499 | { | ||
1500 | receiver->d_qh = | ||
1501 | GNUNET_TRANSPORT_communicator_mq_add (ch, | ||
1502 | &receiver->target, | ||
1503 | receiver->foreign_addr, | ||
1504 | receiver->d_mtu, | ||
1505 | acks_to_add, | ||
1506 | 1, /* Priority */ | ||
1507 | receiver->nt, | ||
1508 | GNUNET_TRANSPORT_CS_OUTBOUND, | ||
1509 | receiver->d_mq); | ||
1510 | } | ||
1511 | else | ||
1512 | { | ||
1513 | GNUNET_TRANSPORT_communicator_mq_update (ch, | ||
1514 | receiver->d_qh, | ||
1515 | acks_to_add, | ||
1516 | 1); | ||
1517 | } | ||
1498 | 1518 | ||
1499 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1500 | "Tell transport we have %u more acks!\n", | 1520 | "Tell transport we have %u more acks!\n", |
@@ -1502,10 +1522,7 @@ add_acks (struct SharedSecret *ss, int acks_to_add) | |||
1502 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1522 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1503 | "%u kce for rekeying.\n", | 1523 | "%u kce for rekeying.\n", |
1504 | receiver->number_rekeying_kce); | 1524 | receiver->number_rekeying_kce); |
1505 | GNUNET_TRANSPORT_communicator_mq_update (ch, | 1525 | |
1506 | receiver->d_qh, | ||
1507 | acks_to_add, | ||
1508 | 1); | ||
1509 | // Until here for alternativ 1 | 1526 | // Until here for alternativ 1 |
1510 | 1527 | ||
1511 | /* move ss to head to avoid discarding it anytime soon! */ | 1528 | /* move ss to head to avoid discarding it anytime soon! */ |
@@ -1744,7 +1761,7 @@ kce_generate_cb (void *cls) | |||
1744 | if (((GNUNET_NO == ss->sender->rekeying) && (ss->sender->acks_available < | 1761 | if (((GNUNET_NO == ss->sender->rekeying) && (ss->sender->acks_available < |
1745 | KCN_TARGET) ) || | 1762 | KCN_TARGET) ) || |
1746 | ((ss->sender->ss_rekey == ss) && (GNUNET_YES == ss->sender->rekeying) && | 1763 | ((ss->sender->ss_rekey == ss) && (GNUNET_YES == ss->sender->rekeying) && |
1747 | (ss->sender->acks_available < 128))) | 1764 | (ss->sender->acks_available < KCN_TARGET))) |
1748 | { | 1765 | { |
1749 | 1766 | ||
1750 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1767 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1754,20 +1771,24 @@ kce_generate_cb (void *cls) | |||
1754 | for (int i = 0; i < GENERATE_AT_ONCE; i++) | 1771 | for (int i = 0; i < GENERATE_AT_ONCE; i++) |
1755 | kce_generate (ss, ++ss->sequence_allowed); | 1772 | kce_generate (ss, ++ss->sequence_allowed); |
1756 | 1773 | ||
1757 | ss->sender->kce_task = GNUNET_SCHEDULER_add_delayed ( | 1774 | if (KCN_TARGET > ss->sender->acks_available) |
1758 | WORKING_QUEUE_INTERVALL, | 1775 | { |
1759 | kce_generate_cb, | 1776 | ss->sender->kce_task = GNUNET_SCHEDULER_add_delayed ( |
1760 | ss); | 1777 | WORKING_QUEUE_INTERVALL, |
1761 | } | 1778 | kce_generate_cb, |
1762 | else | 1779 | ss); |
1763 | { | 1780 | } |
1764 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1781 | else |
1765 | "We have enough keys.\n"); | 1782 | { |
1766 | ss_finished = ss; | 1783 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1767 | ss->sender->kce_task_finished = GNUNET_YES; | 1784 | "We have enough keys.\n"); |
1785 | ss_finished = ss; | ||
1786 | ss->sender->kce_task_finished = GNUNET_YES; | ||
1787 | } | ||
1768 | } | 1788 | } |
1769 | 1789 | ||
1770 | 1790 | ||
1791 | |||
1771 | } | 1792 | } |
1772 | 1793 | ||
1773 | 1794 | ||
@@ -1850,7 +1871,17 @@ consider_ss_ack (struct SharedSecret *ss, int initial) | |||
1850 | kce_generate (ss, ++ss->sequence_allowed); | 1871 | kce_generate (ss, ++ss->sequence_allowed); |
1851 | }*/ | 1872 | }*/ |
1852 | 1873 | ||
1853 | if (((NULL != kce_task) && kce_task_finished) || (GNUNET_NO == initial)) | 1874 | if (NULL != kce_task) |
1875 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1876 | "kce_task is not NULL\n"); | ||
1877 | if (kce_task_finished) | ||
1878 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1879 | "kce_task_finished: GNUNET_YES\n"); | ||
1880 | if (initial) | ||
1881 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1882 | "initial: GNUNET_YES\n"); | ||
1883 | |||
1884 | if ( kce_task_finished || (GNUNET_NO == initial)) | ||
1854 | { | 1885 | { |
1855 | struct UDPAck ack; | 1886 | struct UDPAck ack; |
1856 | struct SharedSecret *ss_tell; | 1887 | struct SharedSecret *ss_tell; |
@@ -1877,8 +1908,7 @@ consider_ss_ack (struct SharedSecret *ss, int initial) | |||
1877 | if (GNUNET_NO != initial) | 1908 | if (GNUNET_NO != initial) |
1878 | { | 1909 | { |
1879 | destroy_all_secrets (ss, GNUNET_YES); | 1910 | destroy_all_secrets (ss, GNUNET_YES); |
1880 | kce_task = NULL; | 1911 | ss->sender->kce_task_finished = GNUNET_NO; |
1881 | kce_task_finished = GNUNET_NO; | ||
1882 | } | 1912 | } |
1883 | } | 1913 | } |
1884 | else if ((NULL == kce_task) && ((KCN_THRESHOLD > | 1914 | else if ((NULL == kce_task) && ((KCN_THRESHOLD > |
@@ -2678,8 +2708,10 @@ mq_send_kx (struct GNUNET_MQ_Handle *mq, | |||
2678 | receiver->address_len)) | 2708 | receiver->address_len)) |
2679 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); | 2709 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); |
2680 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2710 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2681 | "Sending KX to %s\n", GNUNET_a2s (receiver->address, | 2711 | "Sending KX with payload size %u to %s\n", |
2682 | receiver->address_len)); | 2712 | msize, |
2713 | GNUNET_a2s (receiver->address, | ||
2714 | receiver->address_len)); | ||
2683 | GNUNET_MQ_impl_send_continue (mq); | 2715 | GNUNET_MQ_impl_send_continue (mq); |
2684 | } | 2716 | } |
2685 | 2717 | ||
@@ -2940,7 +2972,8 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
2940 | receiver->address_len)) | 2972 | receiver->address_len)) |
2941 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); | 2973 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); |
2942 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2974 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2943 | "Sending UDPBox %u acks left\n", | 2975 | "Sending UDPBox with payload size %u, %u acks left\n", |
2976 | msize, | ||
2944 | receiver->acks_available); | 2977 | receiver->acks_available); |
2945 | GNUNET_MQ_impl_send_continue (mq); | 2978 | GNUNET_MQ_impl_send_continue (mq); |
2946 | receiver->acks_available--; | 2979 | receiver->acks_available--; |
@@ -3135,17 +3168,6 @@ setup_receiver_mq (struct ReceiverAddress *receiver) | |||
3135 | receiver->nt, | 3168 | receiver->nt, |
3136 | GNUNET_TRANSPORT_CS_OUTBOUND, | 3169 | GNUNET_TRANSPORT_CS_OUTBOUND, |
3137 | receiver->kx_mq); | 3170 | receiver->kx_mq); |
3138 | receiver->d_qh = | ||
3139 | GNUNET_TRANSPORT_communicator_mq_add (ch, | ||
3140 | &receiver->target, | ||
3141 | receiver->foreign_addr, | ||
3142 | receiver->d_mtu, | ||
3143 | 0, /* Initialize with 0 acks */ | ||
3144 | 1, /* Priority */ | ||
3145 | receiver->nt, | ||
3146 | GNUNET_TRANSPORT_CS_OUTBOUND, | ||
3147 | receiver->d_mq); | ||
3148 | |||
3149 | } | 3171 | } |
3150 | 3172 | ||
3151 | 3173 | ||
@@ -3755,9 +3777,11 @@ run (void *cls, | |||
3755 | GNUNET_free (bindto); | 3777 | GNUNET_free (bindto); |
3756 | in = (struct sockaddr *) &in_sto; | 3778 | in = (struct sockaddr *) &in_sto; |
3757 | in_len = sto_len; | 3779 | in_len = sto_len; |
3758 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3780 | GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, |
3759 | "Bound to `%s'\n", | 3781 | "transport", |
3760 | GNUNET_a2s ((const struct sockaddr *) &in_sto, sto_len)); | 3782 | "Bound to `%s'\n", |
3783 | GNUNET_a2s ((const struct sockaddr *) &in_sto, | ||
3784 | sto_len)); | ||
3761 | switch (in->sa_family) | 3785 | switch (in->sa_family) |
3762 | { | 3786 | { |
3763 | case AF_INET: | 3787 | case AF_INET: |
@@ -3853,6 +3877,9 @@ main (int argc, char *const *argv) | |||
3853 | }; | 3877 | }; |
3854 | int ret; | 3878 | int ret; |
3855 | 3879 | ||
3880 | GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, | ||
3881 | "transport", | ||
3882 | "Starting udp communicator\n"); | ||
3856 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 3883 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
3857 | return 2; | 3884 | return 2; |
3858 | 3885 | ||