diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-12-20 12:22:39 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-12-20 12:22:39 +0100 |
commit | 8f0d7e9187fa5f674275ed119cd58fd1b67037dc (patch) | |
tree | eea7f850c42ea3d56742a62fe1f84b3784a5f251 /src | |
parent | 096728973eb9d140606b392d5009d5ffc3206272 (diff) | |
download | gnunet-8f0d7e9187fa5f674275ed119cd58fd1b67037dc.tar.gz gnunet-8f0d7e9187fa5f674275ed119cd58fd1b67037dc.zip |
rudimentary fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/test_communicator_basic.c | 76 |
1 files changed, 30 insertions, 46 deletions
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c index fcdbb4b0e..ea1a7b1fb 100644 --- a/src/transport/test_communicator_basic.c +++ b/src/transport/test_communicator_basic.c | |||
@@ -271,7 +271,6 @@ latency_timeout (void *cls) | |||
271 | NULL); | 271 | NULL); |
272 | return; | 272 | return; |
273 | } | 273 | } |
274 | |||
275 | switch (phase) | 274 | switch (phase) |
276 | { | 275 | { |
277 | case TP_INIT: | 276 | case TP_INIT: |
@@ -332,14 +331,6 @@ size_test (void *cls) | |||
332 | } | 331 | } |
333 | 332 | ||
334 | 333 | ||
335 | /*static void | ||
336 | size_test (void *cls) | ||
337 | { | ||
338 | GNUNET_SCHEDULER_add_delayed (DELAY, | ||
339 | &size_test_cb, | ||
340 | NULL); | ||
341 | }*/ | ||
342 | |||
343 | static void | 334 | static void |
344 | long_test (void *cls); | 335 | long_test (void *cls); |
345 | 336 | ||
@@ -354,21 +345,20 @@ long_test_cb (void *cls) | |||
354 | (unsigned int) num_received_long); | 345 | (unsigned int) num_received_long); |
355 | payload = make_payload (long_message_size); | 346 | payload = make_payload (long_message_size); |
356 | num_sent_long++; | 347 | num_sent_long++; |
357 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, | 348 | GNUNET_TRANSPORT_TESTING_transport_communicator_send ( |
358 | ((BURST_PACKETS | 349 | my_tc, |
359 | * 0.91 == | 350 | ((BURST_PACKETS * 0.91 == num_received_long) || |
360 | num_received_long) || | 351 | (BURST_PACKETS == num_sent_long)) |
361 | (BURST_PACKETS == | 352 | ? NULL |
362 | num_sent_long)) | 353 | : &long_test, |
363 | ? NULL | 354 | NULL, |
364 | : &long_test, | 355 | payload, |
365 | NULL, | 356 | long_message_size); |
366 | payload, | ||
367 | long_message_size); | ||
368 | GNUNET_free (payload); | 357 | GNUNET_free (payload); |
369 | timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply ( | 358 | timeout = GNUNET_TIME_relative_to_absolute ( |
370 | GNUNET_TIME_UNIT_SECONDS, | 359 | GNUNET_TIME_relative_multiply ( |
371 | TIMEOUT_MULTIPLIER)); | 360 | GNUNET_TIME_UNIT_SECONDS, |
361 | TIMEOUT_MULTIPLIER)); | ||
372 | } | 362 | } |
373 | 363 | ||
374 | 364 | ||
@@ -387,6 +377,7 @@ long_test (void *cls) | |||
387 | static void | 377 | static void |
388 | short_test (void *cls); | 378 | short_test (void *cls); |
389 | 379 | ||
380 | |||
390 | static void | 381 | static void |
391 | short_test_cb (void *cls) | 382 | short_test_cb (void *cls) |
392 | { | 383 | { |
@@ -620,14 +611,14 @@ process_statistics (void *cls, | |||
620 | * @param msg Received message | 611 | * @param msg Received message |
621 | */ | 612 | */ |
622 | static void | 613 | static void |
623 | incoming_message_cb (void *cls, | 614 | incoming_message_cb ( |
624 | struct | 615 | void *cls, |
625 | GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle | 616 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h, |
626 | *tc_h, | 617 | const char *payload, |
627 | const char*payload, | 618 | size_t payload_len) |
628 | size_t payload_len) | ||
629 | { | 619 | { |
630 | if (0 != strcmp ((char*) cls, cfg_peers_name[NUM_PEERS - 1])) | 620 | if (0 != strcmp ((char*) cls, |
621 | cfg_peers_name[NUM_PEERS - 1])) | ||
631 | { | 622 | { |
632 | LOG (GNUNET_ERROR_TYPE_WARNING, | 623 | LOG (GNUNET_ERROR_TYPE_WARNING, |
633 | "unexpected receiver...\n"); | 624 | "unexpected receiver...\n"); |
@@ -652,11 +643,9 @@ incoming_message_cb (void *cls, | |||
652 | { | 643 | { |
653 | LOG (GNUNET_ERROR_TYPE_MESSAGE, | 644 | LOG (GNUNET_ERROR_TYPE_MESSAGE, |
654 | "Short size packet test done.\n"); | 645 | "Short size packet test done.\n"); |
655 | char *goodput = GNUNET_STRINGS_byte_size_fancy ((SHORT_MESSAGE_SIZE | 646 | char *goodput = GNUNET_STRINGS_byte_size_fancy ( |
656 | * num_received_short | 647 | (SHORT_MESSAGE_SIZE * num_received_short * 1000 * 1000) |
657 | * 1000 | 648 | / duration.rel_value_us); |
658 | * 1000) | ||
659 | / duration.rel_value_us); | ||
660 | LOG (GNUNET_ERROR_TYPE_MESSAGE, | 649 | LOG (GNUNET_ERROR_TYPE_MESSAGE, |
661 | "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", | 650 | "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", |
662 | (unsigned long) num_received_short, | 651 | (unsigned long) num_received_short, |
@@ -689,12 +678,10 @@ incoming_message_cb (void *cls, | |||
689 | { | 678 | { |
690 | LOG (GNUNET_ERROR_TYPE_MESSAGE, | 679 | LOG (GNUNET_ERROR_TYPE_MESSAGE, |
691 | "Long size packet test done.\n"); | 680 | "Long size packet test done.\n"); |
692 | char *goodput = GNUNET_STRINGS_byte_size_fancy ((long_message_size | 681 | char *goodput = GNUNET_STRINGS_byte_size_fancy ( |
693 | * num_received_long | 682 | (long_message_size * num_received_long * 1000 * 1000) |
694 | * 1000 | 683 | / duration. |
695 | * 1000) | 684 | rel_value_us); |
696 | / duration. | ||
697 | rel_value_us); | ||
698 | 685 | ||
699 | LOG (GNUNET_ERROR_TYPE_MESSAGE, | 686 | LOG (GNUNET_ERROR_TYPE_MESSAGE, |
700 | "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", | 687 | "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", |
@@ -746,8 +733,8 @@ incoming_message_cb (void *cls, | |||
746 | short_test (NULL); | 733 | short_test (NULL); |
747 | break; | 734 | break; |
748 | } | 735 | } |
749 | if ((0 == strcmp ("rekey", test_name)) || (0 == strcmp ("backchannel", | 736 | if ( (0 == strcmp ("rekey", test_name)) || |
750 | test_name)) ) | 737 | (0 == strcmp ("backchannel", test_name)) ) |
751 | { | 738 | { |
752 | if (NULL != box_stats) | 739 | if (NULL != box_stats) |
753 | GNUNET_STATISTICS_get_cancel (box_stats); | 740 | GNUNET_STATISTICS_get_cancel (box_stats); |
@@ -931,15 +918,12 @@ main (int argc, | |||
931 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 918 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
932 | "test_name: %s\n", | 919 | "test_name: %s\n", |
933 | test_name); | 920 | test_name); |
934 | |||
935 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 921 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
936 | "communicator_name: %s\n", | 922 | "communicator_name: %s\n", |
937 | communicator_name); | 923 | communicator_name); |
938 | |||
939 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 924 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
940 | "communicator_binary: %s\n", | 925 | "communicator_binary: %s\n", |
941 | communicator_binary); | 926 | communicator_binary); |
942 | |||
943 | GNUNET_SCHEDULER_run (&run, | 927 | GNUNET_SCHEDULER_run (&run, |
944 | NULL); | 928 | NULL); |
945 | return ret; | 929 | return ret; |