diff options
author | t3sserakt <t3ss@posteo.de> | 2021-01-05 17:39:22 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-01-05 21:19:44 +0100 |
commit | 6bf35601f3eb93a7fcd3401b42be8d53f79c47d8 (patch) | |
tree | 14a30964eb35564f1cec7c4412661427dbeab16b /src/transport | |
parent | fac97cea47df432d6418e0399e799e47057e89d7 (diff) | |
download | gnunet-6bf35601f3eb93a7fcd3401b42be8d53f79c47d8.tar.gz gnunet-6bf35601f3eb93a7fcd3401b42be8d53f79c47d8.zip |
- added configuration to the tng communicator test code
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/test_communicator_basic.c | 415 | ||||
-rw-r--r-- | src/transport/test_communicator_tcp_basic_peer1.conf | 5 |
2 files changed, 274 insertions, 146 deletions
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c index 1f85a9895..0250de474 100644 --- a/src/transport/test_communicator_basic.c +++ b/src/transport/test_communicator_basic.c | |||
@@ -81,10 +81,14 @@ static struct GNUNET_STATISTICS_GetHandle *box_stats; | |||
81 | 81 | ||
82 | static struct GNUNET_STATISTICS_GetHandle *rekey_stats; | 82 | static struct GNUNET_STATISTICS_GetHandle *rekey_stats; |
83 | 83 | ||
84 | #define TEST_SECTION "test-setup" | ||
85 | |||
84 | #define SHORT_MESSAGE_SIZE 128 | 86 | #define SHORT_MESSAGE_SIZE 128 |
85 | 87 | ||
86 | #define LONG_MESSAGE_SIZE 32000 /* FIXME */ | 88 | #define LONG_MESSAGE_SIZE 32000 /* FIXME */ |
87 | 89 | ||
90 | #define ALLOWED_PACKET_LOSS 91 | ||
91 | |||
88 | #define BURST_PACKETS 5000 | 92 | #define BURST_PACKETS 5000 |
89 | 93 | ||
90 | #define TOTAL_ITERATIONS 1 | 94 | #define TOTAL_ITERATIONS 1 |
@@ -114,6 +118,27 @@ enum TestPhase | |||
114 | TP_SIZE_CHECK | 118 | TP_SIZE_CHECK |
115 | }; | 119 | }; |
116 | 120 | ||
121 | static unsigned int phase_short; | ||
122 | |||
123 | static unsigned int phase_long; | ||
124 | |||
125 | static unsigned int phase_size; | ||
126 | |||
127 | static long long unsigned int allowed_packet_loss_short; | ||
128 | |||
129 | static long long unsigned int allowed_packet_loss_long; | ||
130 | |||
131 | static long long unsigned int burst_packets_short; | ||
132 | |||
133 | static long long unsigned int burst_packets_long; | ||
134 | |||
135 | static long long unsigned int delay_long_value; | ||
136 | |||
137 | static long long unsigned int delay_short_value; | ||
138 | |||
139 | static struct GNUNET_TIME_Relative delay_short; | ||
140 | |||
141 | static struct GNUNET_TIME_Relative delay_long; | ||
117 | 142 | ||
118 | static size_t num_sent_short = 0; | 143 | static size_t num_sent_short = 0; |
119 | 144 | ||
@@ -300,10 +325,6 @@ latency_timeout (void *cls) | |||
300 | GNUNET_SCHEDULER_shutdown (); | 325 | GNUNET_SCHEDULER_shutdown (); |
301 | } | 326 | } |
302 | 327 | ||
303 | |||
304 | /*static void | ||
305 | size_test (void *cls);*/ | ||
306 | |||
307 | static void | 328 | static void |
308 | size_test (void *cls) | 329 | size_test (void *cls) |
309 | { | 330 | { |
@@ -350,7 +371,7 @@ long_test_cb (void *cls) | |||
350 | payload = make_payload (long_message_size); | 371 | payload = make_payload (long_message_size); |
351 | num_sent_long++; | 372 | num_sent_long++; |
352 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, | 373 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, |
353 | (BURST_PACKETS == | 374 | (burst_packets_long == |
354 | num_sent_long) | 375 | num_sent_long) |
355 | ? NULL | 376 | ? NULL |
356 | : &long_test, | 377 | : &long_test, |
@@ -368,10 +389,7 @@ long_test_cb (void *cls) | |||
368 | static void | 389 | static void |
369 | long_test (void *cls) | 390 | long_test (void *cls) |
370 | { | 391 | { |
371 | /*LOG (GNUNET_ERROR_TYPE_DEBUG, | 392 | GNUNET_SCHEDULER_add_delayed (delay_long, |
372 | "long_test %u\n", | ||
373 | num_sent_long);*/ | ||
374 | GNUNET_SCHEDULER_add_delayed (DELAY, | ||
375 | &long_test_cb, | 393 | &long_test_cb, |
376 | NULL); | 394 | NULL); |
377 | } | 395 | } |
@@ -393,7 +411,7 @@ short_test_cb (void *cls) | |||
393 | payload = make_payload (SHORT_MESSAGE_SIZE); | 411 | payload = make_payload (SHORT_MESSAGE_SIZE); |
394 | num_sent_short++; | 412 | num_sent_short++; |
395 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, | 413 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, |
396 | (BURST_PACKETS == | 414 | (burst_packets_short == |
397 | num_sent_short) | 415 | num_sent_short) |
398 | ? NULL | 416 | ? NULL |
399 | : &short_test, | 417 | : &short_test, |
@@ -410,40 +428,164 @@ short_test_cb (void *cls) | |||
410 | static void | 428 | static void |
411 | short_test (void *cls) | 429 | short_test (void *cls) |
412 | { | 430 | { |
413 | GNUNET_SCHEDULER_add_delayed (DELAY, | 431 | GNUNET_SCHEDULER_add_delayed (delay_short, |
414 | &short_test_cb, | 432 | &short_test_cb, |
415 | NULL); | 433 | NULL); |
416 | } | 434 | } |
417 | 435 | ||
418 | 436 | ||
419 | static int test_prepared = GNUNET_NO; | 437 | /* static int test_prepared = GNUNET_NO; */ |
438 | |||
439 | /* This helps establishing the backchannel */ | ||
440 | /* static void */ | ||
441 | /* prepare_test (void *cls) */ | ||
442 | /* { */ | ||
443 | /* char *payload; */ | ||
444 | |||
445 | /* if (GNUNET_YES == test_prepared) */ | ||
446 | /* { */ | ||
447 | /* GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, */ | ||
448 | /* &short_test, */ | ||
449 | /* NULL); */ | ||
450 | /* return; */ | ||
451 | /* } */ | ||
452 | /* test_prepared = GNUNET_YES; */ | ||
453 | /* payload = make_payload (SHORT_MESSAGE_SIZE); */ | ||
454 | /* GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, */ | ||
455 | /* &prepare_test, */ | ||
456 | /* NULL, */ | ||
457 | /* payload, */ | ||
458 | /* SHORT_MESSAGE_SIZE); */ | ||
459 | /* GNUNET_free (payload); */ | ||
460 | /* } */ | ||
420 | 461 | ||
421 | /** | ||
422 | * This helps establishing the backchannel | ||
423 | */ | ||
424 | static void | 462 | static void |
425 | prepare_test (void *cls) | 463 | process_statistics_box_done (void *cls, int success) |
426 | { | 464 | { |
427 | char *payload; | 465 | if (NULL != box_stats) |
466 | box_stats = NULL; | ||
467 | if (NULL == rekey_stats) | ||
468 | { | ||
469 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
470 | "Finished\n"); | ||
471 | GNUNET_SCHEDULER_shutdown (); | ||
472 | } | ||
473 | } | ||
428 | 474 | ||
429 | if (GNUNET_YES == test_prepared) | 475 | |
476 | static void | ||
477 | process_statistics_rekey_done (void *cls, int success) | ||
478 | { | ||
479 | if (NULL != rekey_stats) | ||
480 | rekey_stats = NULL; | ||
481 | if (NULL == box_stats) | ||
430 | { | 482 | { |
431 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 483 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
432 | &short_test, | 484 | "Finished\n"); |
433 | NULL); | 485 | GNUNET_SCHEDULER_shutdown (); |
434 | return; | ||
435 | } | 486 | } |
436 | test_prepared = GNUNET_YES; | ||
437 | payload = make_payload (SHORT_MESSAGE_SIZE); | ||
438 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, | ||
439 | &prepare_test, | ||
440 | NULL, | ||
441 | payload, | ||
442 | SHORT_MESSAGE_SIZE); | ||
443 | GNUNET_free (payload); | ||
444 | } | 487 | } |
445 | 488 | ||
446 | 489 | ||
490 | static int | ||
491 | process_statistics (void *cls, | ||
492 | const char *subsystem, | ||
493 | const char *name, | ||
494 | uint64_t value, | ||
495 | int is_persistent) | ||
496 | { | ||
497 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
498 | "Statistic: Name %s and value %lu\n", | ||
499 | name, | ||
500 | value); | ||
501 | if ((0 == strcmp ("rekey", test_name)) && (0 == strcmp ( | ||
502 | "# rekeying successful", | ||
503 | name)) && (0 == value)) | ||
504 | { | ||
505 | ret = 2; | ||
506 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
507 | "No successful rekeying!\n"); | ||
508 | GNUNET_SCHEDULER_shutdown (); | ||
509 | } | ||
510 | if ((0 == strcmp ("backchannel", test_name)) && | ||
511 | (0 == strcmp ( | ||
512 | "# messages decrypted with BOX", | ||
513 | name)) | ||
514 | && (9000 > value)) | ||
515 | { | ||
516 | ret = 2; | ||
517 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
518 | "Not enough BOX messages!\n"); | ||
519 | GNUNET_SCHEDULER_shutdown (); | ||
520 | } | ||
521 | if ((0 == strcmp ("rekey", test_name)) && | ||
522 | (0 == strcmp ( | ||
523 | "# messages decrypted with BOX", | ||
524 | name)) | ||
525 | && (6000 > value)) | ||
526 | { | ||
527 | ret = 2; | ||
528 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
529 | "Not enough BOX messages!\n"); | ||
530 | GNUNET_SCHEDULER_shutdown (); | ||
531 | } | ||
532 | return GNUNET_OK; | ||
533 | } | ||
534 | |||
535 | static void | ||
536 | choose_phase () | ||
537 | { | ||
538 | if (GNUNET_YES == phase_short) | ||
539 | { | ||
540 | phase = TP_BURST_SHORT; | ||
541 | start_short = GNUNET_TIME_absolute_get (); | ||
542 | short_test (NULL); | ||
543 | } | ||
544 | else if (GNUNET_YES == phase_long) | ||
545 | { | ||
546 | phase = TP_BURST_LONG; | ||
547 | start_long = GNUNET_TIME_absolute_get (); | ||
548 | long_test (NULL); | ||
549 | } | ||
550 | else if (GNUNET_YES == phase_size) | ||
551 | { | ||
552 | phase = TP_SIZE_CHECK; | ||
553 | size_test (NULL); | ||
554 | } | ||
555 | else | ||
556 | { | ||
557 | if ((0 == strcmp ("udp", communicator_name)) && ((0 == strcmp ("rekey", | ||
558 | test_name)) | ||
559 | ||(0 == strcmp ( | ||
560 | "backchannel", | ||
561 | test_name))) ) | ||
562 | { | ||
563 | if (NULL != box_stats) | ||
564 | GNUNET_STATISTICS_get_cancel (box_stats); | ||
565 | box_stats = GNUNET_STATISTICS_get (stats[1], | ||
566 | "C-UDP", | ||
567 | "# messages decrypted with BOX", | ||
568 | process_statistics_box_done, | ||
569 | &process_statistics, | ||
570 | NULL); | ||
571 | if (NULL != rekey_stats) | ||
572 | GNUNET_STATISTICS_get_cancel (rekey_stats); | ||
573 | rekey_stats = GNUNET_STATISTICS_get (stats[0], | ||
574 | "C-UDP", | ||
575 | "# rekeying successful", | ||
576 | process_statistics_rekey_done, | ||
577 | &process_statistics, | ||
578 | NULL); | ||
579 | } | ||
580 | else | ||
581 | { | ||
582 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
583 | "Finished\n"); | ||
584 | GNUNET_SCHEDULER_shutdown (); | ||
585 | } | ||
586 | } | ||
587 | } | ||
588 | |||
447 | /** | 589 | /** |
448 | * @brief Handle opening of queue | 590 | * @brief Handle opening of queue |
449 | * | 591 | * |
@@ -468,14 +610,14 @@ add_queue_cb (void *cls, | |||
468 | return; // TODO? | 610 | return; // TODO? |
469 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 611 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
470 | "Queue established, starting test...\n"); | 612 | "Queue established, starting test...\n"); |
471 | start_short = GNUNET_TIME_absolute_get (); | 613 | // start_short = GNUNET_TIME_absolute_get (); |
472 | my_tc = tc_h; | 614 | my_tc = tc_h; |
473 | if (0 != mtu) /* Message header overhead */ | 615 | if (0 != mtu) /* Message header overhead */ |
474 | long_message_size = mtu - sizeof(struct GNUNET_TRANSPORT_SendMessageTo) | 616 | long_message_size = mtu - sizeof(struct GNUNET_TRANSPORT_SendMessageTo) |
475 | - sizeof(struct GNUNET_MessageHeader); | 617 | - sizeof(struct GNUNET_MessageHeader); |
476 | else | 618 | else |
477 | long_message_size = LONG_MESSAGE_SIZE; | 619 | long_message_size = LONG_MESSAGE_SIZE; |
478 | phase = TP_BURST_SHORT; | 620 | // phase = TP_BURST_SHORT; |
479 | timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply ( | 621 | timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply ( |
480 | GNUNET_TIME_UNIT_SECONDS, | 622 | GNUNET_TIME_UNIT_SECONDS, |
481 | TIMEOUT_MULTIPLIER)); | 623 | TIMEOUT_MULTIPLIER)); |
@@ -486,7 +628,8 @@ add_queue_cb (void *cls, | |||
486 | &latency_timeout, | 628 | &latency_timeout, |
487 | NULL); | 629 | NULL); |
488 | // prepare_test (NULL); | 630 | // prepare_test (NULL); |
489 | short_test (NULL); | 631 | // short_test (NULL); |
632 | choose_phase (); | ||
490 | } | 633 | } |
491 | 634 | ||
492 | 635 | ||
@@ -501,10 +644,7 @@ update_avg_latency (const char*payload) | |||
501 | ts_n = (struct GNUNET_TIME_AbsoluteNBO *) payload; | 644 | ts_n = (struct GNUNET_TIME_AbsoluteNBO *) payload; |
502 | ts = GNUNET_TIME_absolute_ntoh (*ts_n); | 645 | ts = GNUNET_TIME_absolute_ntoh (*ts_n); |
503 | latency = GNUNET_TIME_absolute_get_duration (ts); | 646 | latency = GNUNET_TIME_absolute_get_duration (ts); |
504 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 647 | |
505 | "Latency of received packet: %s\n", | ||
506 | GNUNET_STRINGS_relative_time_to_string (latency, | ||
507 | GNUNET_YES)); | ||
508 | switch (phase) | 648 | switch (phase) |
509 | { | 649 | { |
510 | case TP_INIT: | 650 | case TP_INIT: |
@@ -525,83 +665,40 @@ update_avg_latency (const char*payload) | |||
525 | else | 665 | else |
526 | avg_latency = ((avg_latency * (num_received - 1)) + latency.rel_value_us) | 666 | avg_latency = ((avg_latency * (num_received - 1)) + latency.rel_value_us) |
527 | / num_received; | 667 | / num_received; |
528 | 668 | LOG (GNUNET_ERROR_TYPE_DEBUG, | |
669 | "Latency of received packet: %s with avg latency %lu\n", | ||
670 | GNUNET_STRINGS_relative_time_to_string (latency, | ||
671 | GNUNET_YES), | ||
672 | avg_latency); | ||
529 | } | 673 | } |
530 | 674 | ||
531 | 675 | ||
532 | static void | ||
533 | process_statistics_box_done (void *cls, int success) | ||
534 | { | ||
535 | if (NULL != box_stats) | ||
536 | box_stats = NULL; | ||
537 | if (NULL == rekey_stats) | ||
538 | { | ||
539 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
540 | "Finished\n"); | ||
541 | GNUNET_SCHEDULER_shutdown (); | ||
542 | } | ||
543 | } | ||
544 | 676 | ||
545 | 677 | ||
546 | static void | 678 | static void |
547 | process_statistics_rekey_done (void *cls, int success) | 679 | load_phase_config () |
548 | { | 680 | { |
549 | if (NULL != rekey_stats) | ||
550 | rekey_stats = NULL; | ||
551 | if (NULL == box_stats) | ||
552 | { | ||
553 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
554 | "Finished\n"); | ||
555 | GNUNET_SCHEDULER_shutdown (); | ||
556 | } | ||
557 | } | ||
558 | 681 | ||
682 | phase_short = GNUNET_CONFIGURATION_get_value_yesno (cfg_peers[0], | ||
683 | TEST_SECTION, | ||
684 | "PHASE_SHORT"); | ||
685 | if (GNUNET_SYSERR == phase_short) | ||
686 | phase_short = GNUNET_YES; | ||
559 | 687 | ||
560 | static int | 688 | phase_long = GNUNET_CONFIGURATION_get_value_yesno (cfg_peers[0], |
561 | process_statistics (void *cls, | 689 | TEST_SECTION, |
562 | const char *subsystem, | 690 | "PHASE_LONG"); |
563 | const char *name, | ||
564 | uint64_t value, | ||
565 | int is_persistent) | ||
566 | { | ||
567 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
568 | "Statistic: Name %s and value %lu\n", | ||
569 | name, | ||
570 | value); | ||
571 | if ((0 == strcmp ("rekey", test_name)) && (0 == strcmp ( | ||
572 | "# rekeying successful", | ||
573 | name)) && (0 == value)) | ||
574 | { | ||
575 | ret = 2; | ||
576 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
577 | "No successful rekeying!\n"); | ||
578 | GNUNET_SCHEDULER_shutdown (); | ||
579 | } | ||
580 | if ((0 == strcmp ("backchannel", test_name)) && | ||
581 | (0 == strcmp ( | ||
582 | "# messages decrypted with BOX", | ||
583 | name)) | ||
584 | && (9000 > value)) | ||
585 | { | ||
586 | ret = 2; | ||
587 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
588 | "Not enough BOX messages!\n"); | ||
589 | GNUNET_SCHEDULER_shutdown (); | ||
590 | } | ||
591 | if ((0 == strcmp ("rekey", test_name)) && | ||
592 | (0 == strcmp ( | ||
593 | "# messages decrypted with BOX", | ||
594 | name)) | ||
595 | && (6000 > value)) | ||
596 | { | ||
597 | ret = 2; | ||
598 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
599 | "Not enough BOX messages!\n"); | ||
600 | GNUNET_SCHEDULER_shutdown (); | ||
601 | } | ||
602 | return GNUNET_OK; | ||
603 | } | ||
604 | 691 | ||
692 | if (GNUNET_SYSERR == phase_long) | ||
693 | phase_long = GNUNET_YES; | ||
694 | |||
695 | phase_size = GNUNET_CONFIGURATION_get_value_yesno (cfg_peers[0], | ||
696 | TEST_SECTION, | ||
697 | "PHASE_SIZE"); | ||
698 | |||
699 | if (GNUNET_SYSERR == phase_size) | ||
700 | phase_size = GNUNET_YES; | ||
701 | } | ||
605 | 702 | ||
606 | /** | 703 | /** |
607 | * @brief Handle an incoming message | 704 | * @brief Handle an incoming message |
@@ -641,8 +738,10 @@ incoming_message_cb ( | |||
641 | num_received_short++; | 738 | num_received_short++; |
642 | duration = GNUNET_TIME_absolute_get_duration (start_short); | 739 | duration = GNUNET_TIME_absolute_get_duration (start_short); |
643 | update_avg_latency (payload); | 740 | update_avg_latency (payload); |
644 | if ((num_sent_short == BURST_PACKETS) && (num_received_short > | 741 | if ((num_sent_short == burst_packets_short) && (num_received_short > |
645 | BURST_PACKETS * 0.91) ) | 742 | burst_packets_short / 100 |
743 | * | ||
744 | allowed_packet_loss_short) ) | ||
646 | { | 745 | { |
647 | LOG (GNUNET_ERROR_TYPE_MESSAGE, | 746 | LOG (GNUNET_ERROR_TYPE_MESSAGE, |
648 | "Short size packet test done.\n"); | 747 | "Short size packet test done.\n"); |
@@ -657,12 +756,14 @@ incoming_message_cb ( | |||
657 | goodput, | 756 | goodput, |
658 | (unsigned long long) avg_latency); | 757 | (unsigned long long) avg_latency); |
659 | GNUNET_free (goodput); | 758 | GNUNET_free (goodput); |
660 | start_long = GNUNET_TIME_absolute_get (); | 759 | // start_long = GNUNET_TIME_absolute_get (); |
661 | phase = TP_BURST_LONG; | 760 | // phase = TP_BURST_LONG; |
662 | // num_sent_short = 0; | 761 | // num_sent_short = 0; |
663 | avg_latency = 0; | 762 | avg_latency = 0; |
664 | // num_received = 0; | 763 | // num_received = 0; |
665 | long_test (NULL); | 764 | phase_short = GNUNET_NO; |
765 | choose_phase (); | ||
766 | // long_test (NULL); | ||
666 | } | 767 | } |
667 | break; | 768 | break; |
668 | } | 769 | } |
@@ -677,8 +778,10 @@ incoming_message_cb ( | |||
677 | num_received_long++; | 778 | num_received_long++; |
678 | duration = GNUNET_TIME_absolute_get_duration (start_long); | 779 | duration = GNUNET_TIME_absolute_get_duration (start_long); |
679 | update_avg_latency (payload); | 780 | update_avg_latency (payload); |
680 | if ((num_sent_long == BURST_PACKETS) && (num_received_long > BURST_PACKETS | 781 | if ((num_sent_long == burst_packets_long) && (num_received_long > |
681 | * 0.91) ) | 782 | burst_packets_long |
783 | / 100 | ||
784 | * allowed_packet_loss_short) ) | ||
682 | { | 785 | { |
683 | LOG (GNUNET_ERROR_TYPE_MESSAGE, | 786 | LOG (GNUNET_ERROR_TYPE_MESSAGE, |
684 | "Long size packet test done.\n"); | 787 | "Long size packet test done.\n"); |
@@ -696,11 +799,13 @@ incoming_message_cb ( | |||
696 | (unsigned long long) avg_latency); | 799 | (unsigned long long) avg_latency); |
697 | GNUNET_free (goodput); | 800 | GNUNET_free (goodput); |
698 | ack = 0; | 801 | ack = 0; |
699 | phase = TP_SIZE_CHECK; | 802 | // phase = TP_SIZE_CHECK; |
700 | // num_received = 0; | 803 | // num_received = 0; |
701 | // num_sent_long = 0; | 804 | // num_sent_long = 0; |
702 | avg_latency = 0; | 805 | avg_latency = 0; |
703 | size_test (NULL); | 806 | // size_test (NULL); |
807 | phase_long = GNUNET_NO; | ||
808 | choose_phase (); | ||
704 | } | 809 | } |
705 | break; | 810 | break; |
706 | } | 811 | } |
@@ -728,44 +833,19 @@ incoming_message_cb ( | |||
728 | iterations_left--; | 833 | iterations_left--; |
729 | if (0 != iterations_left) | 834 | if (0 != iterations_left) |
730 | { | 835 | { |
731 | start_short = GNUNET_TIME_absolute_get (); | 836 | // start_short = GNUNET_TIME_absolute_get (); |
732 | phase = TP_BURST_SHORT; | 837 | // phase = TP_BURST_SHORT; |
733 | num_sent_short = 0; | 838 | num_sent_short = 0; |
734 | num_sent_long = 0; | 839 | num_sent_long = 0; |
735 | num_received_short = 0; | 840 | num_received_short = 0; |
736 | num_received_long = 0; | 841 | num_received_long = 0; |
737 | short_test (NULL); | 842 | // short_test (NULL); |
843 | load_phase_config (); | ||
844 | choose_phase (); | ||
738 | break; | 845 | break; |
739 | } | 846 | } |
740 | if ((0 == strcmp ("udp", communicator_name)) && ((0 == strcmp ("rekey", | 847 | phase_size = GNUNET_NO; |
741 | test_name)) | 848 | choose_phase (); |
742 | ||(0 == strcmp ( | ||
743 | "backchannel", | ||
744 | test_name))) ) | ||
745 | { | ||
746 | if (NULL != box_stats) | ||
747 | GNUNET_STATISTICS_get_cancel (box_stats); | ||
748 | box_stats = GNUNET_STATISTICS_get (stats[1], | ||
749 | "C-UDP", | ||
750 | "# messages decrypted with BOX", | ||
751 | process_statistics_box_done, | ||
752 | &process_statistics, | ||
753 | NULL); | ||
754 | if (NULL != rekey_stats) | ||
755 | GNUNET_STATISTICS_get_cancel (rekey_stats); | ||
756 | rekey_stats = GNUNET_STATISTICS_get (stats[0], | ||
757 | "C-UDP", | ||
758 | "# rekeying successful", | ||
759 | process_statistics_rekey_done, | ||
760 | &process_statistics, | ||
761 | NULL); | ||
762 | } | ||
763 | else | ||
764 | { | ||
765 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
766 | "Finished\n"); | ||
767 | GNUNET_SCHEDULER_shutdown (); | ||
768 | } | ||
769 | } | 849 | } |
770 | break; | 850 | break; |
771 | } | 851 | } |
@@ -802,6 +882,7 @@ do_shutdown (void *cls) | |||
802 | } | 882 | } |
803 | 883 | ||
804 | 884 | ||
885 | |||
805 | /** | 886 | /** |
806 | * @brief Main function called by the scheduler | 887 | * @brief Main function called by the scheduler |
807 | * | 888 | * |
@@ -846,7 +927,6 @@ run (void *cls) | |||
846 | NULL); | 927 | NULL); |
847 | } | 928 | } |
848 | 929 | ||
849 | |||
850 | int | 930 | int |
851 | main (int argc, | 931 | main (int argc, |
852 | char *const *argv) | 932 | char *const *argv) |
@@ -924,6 +1004,49 @@ main (int argc, | |||
924 | i, | 1004 | i, |
925 | GNUNET_i2s_full (&peer_id[i])); | 1005 | GNUNET_i2s_full (&peer_id[i])); |
926 | } | 1006 | } |
1007 | if (GNUNET_OK != | ||
1008 | GNUNET_CONFIGURATION_get_value_number (cfg_peers[0], | ||
1009 | TEST_SECTION, | ||
1010 | "ALLOWED_PACKET_LOSS_SHORT", | ||
1011 | &allowed_packet_loss_short)) | ||
1012 | allowed_packet_loss_short = ALLOWED_PACKET_LOSS; | ||
1013 | if (GNUNET_OK != | ||
1014 | GNUNET_CONFIGURATION_get_value_number (cfg_peers[0], | ||
1015 | TEST_SECTION, | ||
1016 | "ALLOWED_PACKET_LOSS_LONG", | ||
1017 | &allowed_packet_loss_long)) | ||
1018 | allowed_packet_loss_long = ALLOWED_PACKET_LOSS; | ||
1019 | if (GNUNET_OK != | ||
1020 | GNUNET_CONFIGURATION_get_value_number (cfg_peers[0], | ||
1021 | TEST_SECTION, | ||
1022 | "BURST_PACKETS_SHORT", | ||
1023 | &burst_packets_short)) | ||
1024 | burst_packets_short = BURST_PACKETS; | ||
1025 | if (GNUNET_OK != | ||
1026 | GNUNET_CONFIGURATION_get_value_number (cfg_peers[0], | ||
1027 | TEST_SECTION, | ||
1028 | "BURST_ÜACKETS_LONG", | ||
1029 | &burst_packets_long)) | ||
1030 | burst_packets_long = BURST_PACKETS; | ||
1031 | if (GNUNET_OK != | ||
1032 | GNUNET_CONFIGURATION_get_value_number (cfg_peers[0], | ||
1033 | TEST_SECTION, | ||
1034 | "DELAY_SHORT", | ||
1035 | &delay_short_value)) | ||
1036 | delay_short = DELAY; | ||
1037 | else | ||
1038 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, | ||
1039 | delay_short_value); | ||
1040 | if (GNUNET_OK != | ||
1041 | GNUNET_CONFIGURATION_get_value_number (cfg_peers[0], | ||
1042 | TEST_SECTION, | ||
1043 | "DELAY_SHORT", | ||
1044 | &delay_long_value)) | ||
1045 | delay_long = DELAY; | ||
1046 | else | ||
1047 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, | ||
1048 | delay_long_value); | ||
1049 | load_phase_config (); | ||
927 | LOG (GNUNET_ERROR_TYPE_MESSAGE, "Starting test...\n"); | 1050 | LOG (GNUNET_ERROR_TYPE_MESSAGE, "Starting test...\n"); |
928 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1051 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
929 | "argv[0]: %s\n", | 1052 | "argv[0]: %s\n", |
diff --git a/src/transport/test_communicator_tcp_basic_peer1.conf b/src/transport/test_communicator_tcp_basic_peer1.conf index b32aa1c17..dbc227ac6 100644 --- a/src/transport/test_communicator_tcp_basic_peer1.conf +++ b/src/transport/test_communicator_tcp_basic_peer1.conf | |||
@@ -1,5 +1,10 @@ | |||
1 | @INLINE@ test_transport_defaults.conf | 1 | @INLINE@ test_transport_defaults.conf |
2 | 2 | ||
3 | [test-setup] | ||
4 | #PHASE_LONG=NO | ||
5 | #PHASE_SIZE=NO | ||
6 | #BURST_PACKETS_SHORT=1 | ||
7 | |||
3 | [PATHS] | 8 | [PATHS] |
4 | GNUNET_TEST_HOME = $GNUNET_TMP/test-communicator-unix-1/ | 9 | GNUNET_TEST_HOME = $GNUNET_TMP/test-communicator-unix-1/ |
5 | 10 | ||