diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-02-15 11:56:03 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-02-15 11:56:03 +0000 |
commit | 66dd280cc10564606ebba1eb17b9e4c171ca83fb (patch) | |
tree | dda7b21bcbec9cbc9bb4c3b81103ee305ea4c938 /src/testing/test_testing_topology.c | |
parent | 72aa3a0c2a970ae8303ea4b29bef76371b59f6be (diff) | |
download | gnunet-66dd280cc10564606ebba1eb17b9e4c171ca83fb.tar.gz gnunet-66dd280cc10564606ebba1eb17b9e4c171ca83fb.zip |
change to allow number of outstanding ssh connections to be set separately
Diffstat (limited to 'src/testing/test_testing_topology.c')
-rw-r--r-- | src/testing/test_testing_topology.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index 0461af89c..66540c078 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -26,7 +26,9 @@ | |||
26 | #include "gnunet_core_service.h" | 26 | #include "gnunet_core_service.h" |
27 | #include "gnunet_os_lib.h" | 27 | #include "gnunet_os_lib.h" |
28 | 28 | ||
29 | #define VERBOSE GNUNET_YES | 29 | #define VERBOSE GNUNET_NO |
30 | |||
31 | #define PROGRESS_BARS GNUNET_YES | ||
30 | 32 | ||
31 | #define DELAY_FOR_LOGGING GNUNET_NO | 33 | #define DELAY_FOR_LOGGING GNUNET_NO |
32 | 34 | ||
@@ -359,7 +361,7 @@ process_mtype (void *cls, | |||
359 | if (pos->uid != ntohl (msg->uid)) | 361 | if (pos->uid != ntohl (msg->uid)) |
360 | return GNUNET_OK; | 362 | return GNUNET_OK; |
361 | 363 | ||
362 | #if VERBOSE | 364 | #if PROGRESS_BARS |
363 | if ((total_messages_received) % modnum == 0) | 365 | if ((total_messages_received) % modnum == 0) |
364 | { | 366 | { |
365 | if (total_messages_received == 0) | 367 | if (total_messages_received == 0) |
@@ -390,7 +392,7 @@ process_mtype (void *cls, | |||
390 | 392 | ||
391 | if (total_messages_received == expected_messages) | 393 | if (total_messages_received == expected_messages) |
392 | { | 394 | { |
393 | #if VERBOSE | 395 | #if PROGRESS_BARS |
394 | fprintf (stdout, "100%%]\n"); | 396 | fprintf (stdout, "100%%]\n"); |
395 | #endif | 397 | #endif |
396 | GNUNET_SCHEDULER_cancel (die_task); | 398 | GNUNET_SCHEDULER_cancel (die_task); |
@@ -691,7 +693,7 @@ topology_callback (void *cls, | |||
691 | struct TestMessageContext *temp_context; | 693 | struct TestMessageContext *temp_context; |
692 | if (emsg == NULL) | 694 | if (emsg == NULL) |
693 | { | 695 | { |
694 | #if VERBOSE | 696 | #if PROGRESS_BARS |
695 | if ((total_connections) % modnum == 0) | 697 | if ((total_connections) % modnum == 0) |
696 | { | 698 | { |
697 | if (total_connections == 0) | 699 | if (total_connections == 0) |
@@ -738,7 +740,7 @@ topology_callback (void *cls, | |||
738 | 740 | ||
739 | if (total_connections == expected_connections) | 741 | if (total_connections == expected_connections) |
740 | { | 742 | { |
741 | #if VERBOSE | 743 | #if PROGRESS_BARS |
742 | fprintf (stdout, "100%%]\n"); | 744 | fprintf (stdout, "100%%]\n"); |
743 | #endif | 745 | #endif |
744 | #if VERBOSE | 746 | #if VERBOSE |
@@ -748,6 +750,10 @@ topology_callback (void *cls, | |||
748 | #endif | 750 | #endif |
749 | modnum = expected_messages / 4; | 751 | modnum = expected_messages / 4; |
750 | dotnum = (expected_messages / 50) + 1; | 752 | dotnum = (expected_messages / 50) + 1; |
753 | if (modnum == 0) | ||
754 | modnum = 1; | ||
755 | if (dotnum == 0) | ||
756 | dotnum = 1; | ||
751 | GNUNET_SCHEDULER_cancel (die_task); | 757 | GNUNET_SCHEDULER_cancel (die_task); |
752 | die_task = GNUNET_SCHEDULER_NO_TASK; | 758 | die_task = GNUNET_SCHEDULER_NO_TASK; |
753 | #if DELAY_FOR_LOGGING | 759 | #if DELAY_FOR_LOGGING |
@@ -764,7 +770,7 @@ topology_callback (void *cls, | |||
764 | GNUNET_SCHEDULER_add_delayed (settle_time, &send_test_messages, | 770 | GNUNET_SCHEDULER_add_delayed (settle_time, &send_test_messages, |
765 | test_messages); | 771 | test_messages); |
766 | #endif | 772 | #endif |
767 | #if VERBOSE | 773 | #if PROGRESS_BARS |
768 | fprintf (stdout, "Test message progress: ["); | 774 | fprintf (stdout, "Test message progress: ["); |
769 | #endif | 775 | #endif |
770 | 776 | ||
@@ -821,8 +827,8 @@ connect_topology () | |||
821 | connect_timeout, | 827 | connect_timeout, |
822 | connect_attempts, | 828 | connect_attempts, |
823 | &topology_creation_finished, NULL); | 829 | &topology_creation_finished, NULL); |
824 | #if VERBOSE | 830 | #if PROGRESS_BARS |
825 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 831 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
826 | "Have %d expected connections\n", expected_connections); | 832 | "Have %d expected connections\n", expected_connections); |
827 | #endif | 833 | #endif |
828 | } | 834 | } |
@@ -836,12 +842,18 @@ connect_topology () | |||
836 | return; | 842 | return; |
837 | } | 843 | } |
838 | 844 | ||
839 | die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, | 845 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
846 | (GNUNET_TIME_UNIT_SECONDS, | ||
847 | SECONDS_PER_PEER_START * num_peers), | ||
840 | &end_badly, | 848 | &end_badly, |
841 | "from connect topology (timeout)"); | 849 | "from connect topology (timeout)"); |
842 | modnum = expected_connections / 4; | 850 | modnum = expected_connections / 4; |
843 | dotnum = (expected_connections / 50) + 1; | 851 | dotnum = (expected_connections / 50) + 1; |
844 | #if VERBOSE | 852 | if (modnum == 0) |
853 | modnum = 1; | ||
854 | if (dotnum == 0) | ||
855 | dotnum = 1; | ||
856 | #if PROGRESS_BARS | ||
845 | fprintf (stdout, "Peer connection progress: ["); | 857 | fprintf (stdout, "Peer connection progress: ["); |
846 | #endif | 858 | #endif |
847 | } | 859 | } |
@@ -854,7 +866,7 @@ create_topology () | |||
854 | (pg, topology, blacklist_topology, | 866 | (pg, topology, blacklist_topology, |
855 | blacklist_transports) != GNUNET_SYSERR) | 867 | blacklist_transports) != GNUNET_SYSERR) |
856 | { | 868 | { |
857 | #if VERBOSE | 869 | #if PROGRESS_BARS |
858 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 870 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
859 | "Topology set up, now starting peers!\n"); | 871 | "Topology set up, now starting peers!\n"); |
860 | fprintf (stdout, "Daemon start progress ["); | 872 | fprintf (stdout, "Daemon start progress ["); |
@@ -869,7 +881,9 @@ create_topology () | |||
869 | "from create topology (bad return)"); | 881 | "from create topology (bad return)"); |
870 | } | 882 | } |
871 | GNUNET_SCHEDULER_cancel (die_task); | 883 | GNUNET_SCHEDULER_cancel (die_task); |
872 | die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, | 884 | die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
885 | (GNUNET_TIME_UNIT_SECONDS, | ||
886 | SECONDS_PER_PEER_START * num_peers), | ||
873 | &end_badly, | 887 | &end_badly, |
874 | "from continue startup (timeout)"); | 888 | "from continue startup (timeout)"); |
875 | } | 889 | } |
@@ -892,7 +906,7 @@ peers_started_callback (void *cls, | |||
892 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n", | 906 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n", |
893 | (num_peers - peers_left) + 1, num_peers); | 907 | (num_peers - peers_left) + 1, num_peers); |
894 | #endif | 908 | #endif |
895 | #if VERBOSE | 909 | #if PROGRESS_BARS |
896 | if ((num_peers - peers_left) % modnum == 0) | 910 | if ((num_peers - peers_left) % modnum == 0) |
897 | { | 911 | { |
898 | if (num_peers - peers_left == 0) | 912 | if (num_peers - peers_left == 0) |
@@ -912,7 +926,7 @@ peers_started_callback (void *cls, | |||
912 | peers_left--; | 926 | peers_left--; |
913 | if (peers_left == 0) | 927 | if (peers_left == 0) |
914 | { | 928 | { |
915 | #if VERBOSE | 929 | #if PROGRESS_BARS |
916 | fprintf (stdout, "100%%]\n"); | 930 | fprintf (stdout, "100%%]\n"); |
917 | #endif | 931 | #endif |
918 | #if VERBOSE | 932 | #if VERBOSE |
@@ -965,7 +979,7 @@ hostkey_callback (void *cls, | |||
965 | num_peers - peers_left, num_peers, GNUNET_i2s (id)); | 979 | num_peers - peers_left, num_peers, GNUNET_i2s (id)); |
966 | #endif | 980 | #endif |
967 | 981 | ||
968 | #if VERBOSE | 982 | #if PROGRESS_BARS |
969 | if ((num_peers - peers_left) % modnum == 0) | 983 | if ((num_peers - peers_left) % modnum == 0) |
970 | { | 984 | { |
971 | if (num_peers - peers_left == 0) | 985 | if (num_peers - peers_left == 0) |
@@ -985,7 +999,7 @@ hostkey_callback (void *cls, | |||
985 | peers_left--; | 999 | peers_left--; |
986 | if (peers_left == 0) | 1000 | if (peers_left == 0) |
987 | { | 1001 | { |
988 | #if VERBOSE | 1002 | #if PROGRESS_BARS |
989 | fprintf (stdout, "100%%]\n"); | 1003 | fprintf (stdout, "100%%]\n"); |
990 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1004 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
991 | "All %d hostkeys created, now creating topology!\n", | 1005 | "All %d hostkeys created, now creating topology!\n", |
@@ -1148,7 +1162,11 @@ run (void *cls, | |||
1148 | peers_left = num_peers; | 1162 | peers_left = num_peers; |
1149 | modnum = num_peers / 4; | 1163 | modnum = num_peers / 4; |
1150 | dotnum = (num_peers / 50) + 1; | 1164 | dotnum = (num_peers / 50) + 1; |
1151 | #if VERBOSE | 1165 | if (modnum == 0) |
1166 | modnum = 1; | ||
1167 | if (dotnum == 0) | ||
1168 | dotnum = 1; | ||
1169 | #if PROGRESS_BARS | ||
1152 | fprintf (stdout, "Hostkey generation progress: ["); | 1170 | fprintf (stdout, "Hostkey generation progress: ["); |
1153 | #endif | 1171 | #endif |
1154 | /* Set up a task to end testing if peer start fails */ | 1172 | /* Set up a task to end testing if peer start fails */ |