aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_communicator_basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_communicator_basic.c')
-rw-r--r--src/transport/test_communicator_basic.c456
1 files changed, 296 insertions, 160 deletions
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index ea1a7b1fb..0250de474 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -61,6 +61,8 @@ static char *cfg_peers_name[NUM_PEERS];
61 61
62static int ret; 62static int ret;
63 63
64static int bidirect = GNUNET_NO;
65
64static size_t long_message_size; 66static size_t long_message_size;
65 67
66static struct GNUNET_TIME_Absolute start_short; 68static struct GNUNET_TIME_Absolute start_short;
@@ -71,16 +73,22 @@ static struct GNUNET_TIME_Absolute timeout;
71 73
72static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *my_tc; 74static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *my_tc;
73 75
76static char *communicator_name;
77
74static char *test_name; 78static char *test_name;
75 79
76static struct GNUNET_STATISTICS_GetHandle *box_stats; 80static struct GNUNET_STATISTICS_GetHandle *box_stats;
77 81
78static struct GNUNET_STATISTICS_GetHandle *rekey_stats; 82static struct GNUNET_STATISTICS_GetHandle *rekey_stats;
79 83
84#define TEST_SECTION "test-setup"
85
80#define SHORT_MESSAGE_SIZE 128 86#define SHORT_MESSAGE_SIZE 128
81 87
82#define LONG_MESSAGE_SIZE 32000 /* FIXME */ 88#define LONG_MESSAGE_SIZE 32000 /* FIXME */
83 89
90#define ALLOWED_PACKET_LOSS 91
91
84#define BURST_PACKETS 5000 92#define BURST_PACKETS 5000
85 93
86#define TOTAL_ITERATIONS 1 94#define TOTAL_ITERATIONS 1
@@ -110,6 +118,27 @@ enum TestPhase
110 TP_SIZE_CHECK 118 TP_SIZE_CHECK
111}; 119};
112 120
121static unsigned int phase_short;
122
123static unsigned int phase_long;
124
125static unsigned int phase_size;
126
127static long long unsigned int allowed_packet_loss_short;
128
129static long long unsigned int allowed_packet_loss_long;
130
131static long long unsigned int burst_packets_short;
132
133static long long unsigned int burst_packets_long;
134
135static long long unsigned int delay_long_value;
136
137static long long unsigned int delay_short_value;
138
139static struct GNUNET_TIME_Relative delay_short;
140
141static struct GNUNET_TIME_Relative delay_long;
113 142
114static size_t num_sent_short = 0; 143static size_t num_sent_short = 0;
115 144
@@ -296,10 +325,6 @@ latency_timeout (void *cls)
296 GNUNET_SCHEDULER_shutdown (); 325 GNUNET_SCHEDULER_shutdown ();
297} 326}
298 327
299
300/*static void
301 size_test (void *cls);*/
302
303static void 328static void
304size_test (void *cls) 329size_test (void *cls)
305{ 330{
@@ -345,15 +370,14 @@ long_test_cb (void *cls)
345 (unsigned int) num_received_long); 370 (unsigned int) num_received_long);
346 payload = make_payload (long_message_size); 371 payload = make_payload (long_message_size);
347 num_sent_long++; 372 num_sent_long++;
348 GNUNET_TRANSPORT_TESTING_transport_communicator_send ( 373 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
349 my_tc, 374 (burst_packets_long ==
350 ((BURST_PACKETS * 0.91 == num_received_long) || 375 num_sent_long)
351 (BURST_PACKETS == num_sent_long)) 376 ? NULL
352 ? NULL 377 : &long_test,
353 : &long_test, 378 NULL,
354 NULL, 379 payload,
355 payload, 380 long_message_size);
356 long_message_size);
357 GNUNET_free (payload); 381 GNUNET_free (payload);
358 timeout = GNUNET_TIME_relative_to_absolute ( 382 timeout = GNUNET_TIME_relative_to_absolute (
359 GNUNET_TIME_relative_multiply ( 383 GNUNET_TIME_relative_multiply (
@@ -365,10 +389,7 @@ long_test_cb (void *cls)
365static void 389static void
366long_test (void *cls) 390long_test (void *cls)
367{ 391{
368 /*LOG (GNUNET_ERROR_TYPE_DEBUG, 392 GNUNET_SCHEDULER_add_delayed (delay_long,
369 "long_test %u\n",
370 num_sent_long);*/
371 GNUNET_SCHEDULER_add_delayed (DELAY,
372 &long_test_cb, 393 &long_test_cb,
373 NULL); 394 NULL);
374} 395}
@@ -389,15 +410,14 @@ short_test_cb (void *cls)
389 (unsigned int) num_received_short); 410 (unsigned int) num_received_short);
390 payload = make_payload (SHORT_MESSAGE_SIZE); 411 payload = make_payload (SHORT_MESSAGE_SIZE);
391 num_sent_short++; 412 num_sent_short++;
392 GNUNET_TRANSPORT_TESTING_transport_communicator_send ( 413 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
393 my_tc, 414 (burst_packets_short ==
394 ( (BURST_PACKETS * 0.91 == num_received_short) || 415 num_sent_short)
395 (BURST_PACKETS == num_sent_short) ) 416 ? NULL
396 ? NULL 417 : &short_test,
397 : &short_test, 418 NULL,
398 NULL, 419 payload,
399 payload, 420 SHORT_MESSAGE_SIZE);
400 SHORT_MESSAGE_SIZE);
401 GNUNET_free (payload); 421 GNUNET_free (payload);
402 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply ( 422 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply (
403 GNUNET_TIME_UNIT_SECONDS, 423 GNUNET_TIME_UNIT_SECONDS,
@@ -408,40 +428,164 @@ short_test_cb (void *cls)
408static void 428static void
409short_test (void *cls) 429short_test (void *cls)
410{ 430{
411 GNUNET_SCHEDULER_add_delayed (DELAY, 431 GNUNET_SCHEDULER_add_delayed (delay_short,
412 &short_test_cb, 432 &short_test_cb,
413 NULL); 433 NULL);
414} 434}
415 435
416 436
417static 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/* } */
418 461
419/**
420 * This helps establishing the backchannel
421 */
422static void 462static void
423prepare_test (void *cls) 463process_statistics_box_done (void *cls, int success)
424{ 464{
425 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}
474
426 475
427 if (GNUNET_YES == test_prepared) 476static void
477process_statistics_rekey_done (void *cls, int success)
478{
479 if (NULL != rekey_stats)
480 rekey_stats = NULL;
481 if (NULL == box_stats)
428 { 482 {
429 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 483 LOG (GNUNET_ERROR_TYPE_DEBUG,
430 &short_test, 484 "Finished\n");
431 NULL); 485 GNUNET_SCHEDULER_shutdown ();
432 return;
433 } 486 }
434 test_prepared = GNUNET_YES;
435 payload = make_payload (SHORT_MESSAGE_SIZE);
436 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
437 &prepare_test,
438 NULL,
439 payload,
440 SHORT_MESSAGE_SIZE);
441 GNUNET_free (payload);
442} 487}
443 488
444 489
490static int
491process_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
535static void
536choose_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
445/** 589/**
446 * @brief Handle opening of queue 590 * @brief Handle opening of queue
447 * 591 *
@@ -466,14 +610,14 @@ add_queue_cb (void *cls,
466 return; // TODO? 610 return; // TODO?
467 LOG (GNUNET_ERROR_TYPE_DEBUG, 611 LOG (GNUNET_ERROR_TYPE_DEBUG,
468 "Queue established, starting test...\n"); 612 "Queue established, starting test...\n");
469 start_short = GNUNET_TIME_absolute_get (); 613 // start_short = GNUNET_TIME_absolute_get ();
470 my_tc = tc_h; 614 my_tc = tc_h;
471 if (0 != mtu) /* Message header overhead */ 615 if (0 != mtu) /* Message header overhead */
472 long_message_size = mtu - sizeof(struct GNUNET_TRANSPORT_SendMessageTo) 616 long_message_size = mtu - sizeof(struct GNUNET_TRANSPORT_SendMessageTo)
473 - sizeof(struct GNUNET_MessageHeader); 617 - sizeof(struct GNUNET_MessageHeader);
474 else 618 else
475 long_message_size = LONG_MESSAGE_SIZE; 619 long_message_size = LONG_MESSAGE_SIZE;
476 phase = TP_BURST_SHORT; 620 // phase = TP_BURST_SHORT;
477 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply ( 621 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply (
478 GNUNET_TIME_UNIT_SECONDS, 622 GNUNET_TIME_UNIT_SECONDS,
479 TIMEOUT_MULTIPLIER)); 623 TIMEOUT_MULTIPLIER));
@@ -484,7 +628,8 @@ add_queue_cb (void *cls,
484 &latency_timeout, 628 &latency_timeout,
485 NULL); 629 NULL);
486 // prepare_test (NULL); 630 // prepare_test (NULL);
487 short_test (NULL); 631 // short_test (NULL);
632 choose_phase ();
488} 633}
489 634
490 635
@@ -499,10 +644,7 @@ update_avg_latency (const char*payload)
499 ts_n = (struct GNUNET_TIME_AbsoluteNBO *) payload; 644 ts_n = (struct GNUNET_TIME_AbsoluteNBO *) payload;
500 ts = GNUNET_TIME_absolute_ntoh (*ts_n); 645 ts = GNUNET_TIME_absolute_ntoh (*ts_n);
501 latency = GNUNET_TIME_absolute_get_duration (ts); 646 latency = GNUNET_TIME_absolute_get_duration (ts);
502 LOG (GNUNET_ERROR_TYPE_DEBUG, 647
503 "Latency of received packet: %s\n",
504 GNUNET_STRINGS_relative_time_to_string (latency,
505 GNUNET_YES));
506 switch (phase) 648 switch (phase)
507 { 649 {
508 case TP_INIT: 650 case TP_INIT:
@@ -523,83 +665,40 @@ update_avg_latency (const char*payload)
523 else 665 else
524 avg_latency = ((avg_latency * (num_received - 1)) + latency.rel_value_us) 666 avg_latency = ((avg_latency * (num_received - 1)) + latency.rel_value_us)
525 / num_received; 667 / num_received;
526 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);
527} 673}
528 674
529 675
530static void
531process_statistics_box_done (void *cls, int success)
532{
533 if (NULL != box_stats)
534 box_stats = NULL;
535 if (NULL == rekey_stats)
536 {
537 LOG (GNUNET_ERROR_TYPE_DEBUG,
538 "Finished\n");
539 GNUNET_SCHEDULER_shutdown ();
540 }
541}
542 676
543 677
544static void 678static void
545process_statistics_rekey_done (void *cls, int success) 679load_phase_config ()
546{ 680{
547 if (NULL != rekey_stats)
548 rekey_stats = NULL;
549 if (NULL == box_stats)
550 {
551 LOG (GNUNET_ERROR_TYPE_DEBUG,
552 "Finished\n");
553 GNUNET_SCHEDULER_shutdown ();
554 }
555}
556 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;
557 687
558static int 688 phase_long = GNUNET_CONFIGURATION_get_value_yesno (cfg_peers[0],
559process_statistics (void *cls, 689 TEST_SECTION,
560 const char *subsystem, 690 "PHASE_LONG");
561 const char *name, 691
562 uint64_t value, 692 if (GNUNET_SYSERR == phase_long)
563 int is_persistent) 693 phase_long = GNUNET_YES;
564{
565 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
566 "Statistic: Name %s and value %lu\n",
567 name,
568 value);
569 if ((0 == strcmp ("rekey", test_name)) && (0 == strcmp (
570 "# rekeying successful",
571 name)) && (0 == value))
572 {
573 ret = 2;
574 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
575 "No successful rekeying!\n");
576 GNUNET_SCHEDULER_shutdown ();
577 }
578 if ((0 == strcmp ("backchannel", test_name)) &&
579 (0 == strcmp (
580 "# messages decrypted with BOX",
581 name))
582 && (9000 > value))
583 {
584 ret = 2;
585 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
586 "Not enough BOX messages!\n");
587 GNUNET_SCHEDULER_shutdown ();
588 }
589 if ((0 == strcmp ("rekey", test_name)) &&
590 (0 == strcmp (
591 "# messages decrypted with BOX",
592 name))
593 && (6000 > value))
594 {
595 ret = 2;
596 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
597 "Not enough BOX messages!\n");
598 GNUNET_SCHEDULER_shutdown ();
599 }
600 return GNUNET_OK;
601}
602 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}
603 702
604/** 703/**
605 * @brief Handle an incoming message 704 * @brief Handle an incoming message
@@ -639,7 +738,10 @@ incoming_message_cb (
639 num_received_short++; 738 num_received_short++;
640 duration = GNUNET_TIME_absolute_get_duration (start_short); 739 duration = GNUNET_TIME_absolute_get_duration (start_short);
641 update_avg_latency (payload); 740 update_avg_latency (payload);
642 if (num_received_short == BURST_PACKETS * 0.91) 741 if ((num_sent_short == burst_packets_short) && (num_received_short >
742 burst_packets_short / 100
743 *
744 allowed_packet_loss_short) )
643 { 745 {
644 LOG (GNUNET_ERROR_TYPE_MESSAGE, 746 LOG (GNUNET_ERROR_TYPE_MESSAGE,
645 "Short size packet test done.\n"); 747 "Short size packet test done.\n");
@@ -654,12 +756,14 @@ incoming_message_cb (
654 goodput, 756 goodput,
655 (unsigned long long) avg_latency); 757 (unsigned long long) avg_latency);
656 GNUNET_free (goodput); 758 GNUNET_free (goodput);
657 start_long = GNUNET_TIME_absolute_get (); 759 // start_long = GNUNET_TIME_absolute_get ();
658 phase = TP_BURST_LONG; 760 // phase = TP_BURST_LONG;
659 // num_sent_short = 0; 761 // num_sent_short = 0;
660 avg_latency = 0; 762 avg_latency = 0;
661 // num_received = 0; 763 // num_received = 0;
662 long_test (NULL); 764 phase_short = GNUNET_NO;
765 choose_phase ();
766 // long_test (NULL);
663 } 767 }
664 break; 768 break;
665 } 769 }
@@ -674,7 +778,10 @@ incoming_message_cb (
674 num_received_long++; 778 num_received_long++;
675 duration = GNUNET_TIME_absolute_get_duration (start_long); 779 duration = GNUNET_TIME_absolute_get_duration (start_long);
676 update_avg_latency (payload); 780 update_avg_latency (payload);
677 if (num_received_long == BURST_PACKETS * 0.91) 781 if ((num_sent_long == burst_packets_long) && (num_received_long >
782 burst_packets_long
783 / 100
784 * allowed_packet_loss_short) )
678 { 785 {
679 LOG (GNUNET_ERROR_TYPE_MESSAGE, 786 LOG (GNUNET_ERROR_TYPE_MESSAGE,
680 "Long size packet test done.\n"); 787 "Long size packet test done.\n");
@@ -692,11 +799,13 @@ incoming_message_cb (
692 (unsigned long long) avg_latency); 799 (unsigned long long) avg_latency);
693 GNUNET_free (goodput); 800 GNUNET_free (goodput);
694 ack = 0; 801 ack = 0;
695 phase = TP_SIZE_CHECK; 802 // phase = TP_SIZE_CHECK;
696 // num_received = 0; 803 // num_received = 0;
697 // num_sent_long = 0; 804 // num_sent_long = 0;
698 avg_latency = 0; 805 avg_latency = 0;
699 size_test (NULL); 806 // size_test (NULL);
807 phase_long = GNUNET_NO;
808 choose_phase ();
700 } 809 }
701 break; 810 break;
702 } 811 }
@@ -724,41 +833,19 @@ incoming_message_cb (
724 iterations_left--; 833 iterations_left--;
725 if (0 != iterations_left) 834 if (0 != iterations_left)
726 { 835 {
727 start_short = GNUNET_TIME_absolute_get (); 836 // start_short = GNUNET_TIME_absolute_get ();
728 phase = TP_BURST_SHORT; 837 // phase = TP_BURST_SHORT;
729 num_sent_short = 0; 838 num_sent_short = 0;
730 num_sent_long = 0; 839 num_sent_long = 0;
731 num_received_short = 0; 840 num_received_short = 0;
732 num_received_long = 0; 841 num_received_long = 0;
733 short_test (NULL); 842 // short_test (NULL);
843 load_phase_config ();
844 choose_phase ();
734 break; 845 break;
735 } 846 }
736 if ( (0 == strcmp ("rekey", test_name)) || 847 phase_size = GNUNET_NO;
737 (0 == strcmp ("backchannel", test_name)) ) 848 choose_phase ();
738 {
739 if (NULL != box_stats)
740 GNUNET_STATISTICS_get_cancel (box_stats);
741 box_stats = GNUNET_STATISTICS_get (stats[1],
742 "C-UDP",
743 "# messages decrypted with BOX",
744 process_statistics_box_done,
745 &process_statistics,
746 NULL);
747 if (NULL != rekey_stats)
748 GNUNET_STATISTICS_get_cancel (rekey_stats);
749 rekey_stats = GNUNET_STATISTICS_get (stats[0],
750 "C-UDP",
751 "# rekeying successful",
752 process_statistics_rekey_done,
753 &process_statistics,
754 NULL);
755 }
756 else
757 {
758 LOG (GNUNET_ERROR_TYPE_DEBUG,
759 "Finished\n");
760 GNUNET_SCHEDULER_shutdown ();
761 }
762 } 849 }
763 break; 850 break;
764 } 851 }
@@ -795,6 +882,7 @@ do_shutdown (void *cls)
795} 882}
796 883
797 884
885
798/** 886/**
799 * @brief Main function called by the scheduler 887 * @brief Main function called by the scheduler
800 * 888 *
@@ -821,24 +909,29 @@ run (void *cls)
821 &handle_backchannel_cb, 909 &handle_backchannel_cb,
822 cfg_peers_name[i]); /* cls */ 910 cfg_peers_name[i]); /* cls */
823 911
824 if ((0 == strcmp ("rekey", test_name)) || (0 == strcmp ("backchannel", 912 if ((0 == strcmp ("udp", communicator_name)) && ((0 == strcmp ("rekey",
825 test_name)) ) 913 test_name))||
914 (0 == strcmp (
915 "backchannel",
916 test_name))) )
826 { 917 {
827 stats[i] = GNUNET_STATISTICS_create ("C-UDP", 918 stats[i] = GNUNET_STATISTICS_create ("C-UDP",
828 cfg_peers[i]); 919 cfg_peers[i]);
829 } 920 }
921 else if ((0 == strcmp ("bidirect", test_name)))
922 {
923 bidirect = GNUNET_YES;
924 }
830 } 925 }
831 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, 926 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
832 NULL); 927 NULL);
833} 928}
834 929
835
836int 930int
837main (int argc, 931main (int argc,
838 char *const *argv) 932 char *const *argv)
839{ 933{
840 struct GNUNET_CRYPTO_EddsaPrivateKey *private_key; 934 struct GNUNET_CRYPTO_EddsaPrivateKey *private_key;
841 char *communicator_name;
842 char *test_mode; 935 char *test_mode;
843 char *cfg_peer; 936 char *cfg_peer;
844 937
@@ -911,6 +1004,49 @@ main (int argc,
911 i, 1004 i,
912 GNUNET_i2s_full (&peer_id[i])); 1005 GNUNET_i2s_full (&peer_id[i]));
913 } 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 ();
914 LOG (GNUNET_ERROR_TYPE_MESSAGE, "Starting test...\n"); 1050 LOG (GNUNET_ERROR_TYPE_MESSAGE, "Starting test...\n");
915 LOG (GNUNET_ERROR_TYPE_DEBUG, 1051 LOG (GNUNET_ERROR_TYPE_DEBUG,
916 "argv[0]: %s\n", 1052 "argv[0]: %s\n",