diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-03-14 12:45:17 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-03-14 12:45:17 +0000 |
commit | 09da1fa28c1847c08e9489a55ba7ae0212e22439 (patch) | |
tree | 063ff01ff6b11ecdd7e9a9ef761f42a50d27c162 /src/regex | |
parent | f239cd1ec0253101b7ff8f805cbd6e46ebd122f6 (diff) | |
download | gnunet-09da1fa28c1847c08e9489a55ba7ae0212e22439.tar.gz gnunet-09da1fa28c1847c08e9489a55ba7ae0212e22439.zip |
- adapt to new ARM, debug
Diffstat (limited to 'src/regex')
-rw-r--r-- | src/regex/gnunet-regex-profiler.c | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index 303f1fffc..0f9574c8b 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c | |||
@@ -822,7 +822,7 @@ regex_found_handler (void *cls, | |||
822 | { | 822 | { |
823 | GNUNET_SCHEDULER_cancel (peer->timeout); | 823 | GNUNET_SCHEDULER_cancel (peer->timeout); |
824 | peer->timeout = GNUNET_SCHEDULER_NO_TASK; | 824 | peer->timeout = GNUNET_SCHEDULER_NO_TASK; |
825 | GNUNET_SCHEDULER_add_now (&find_next_string, NULL); | 825 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &find_next_string, NULL); |
826 | } | 826 | } |
827 | 827 | ||
828 | if (NULL == id) | 828 | if (NULL == id) |
@@ -930,7 +930,7 @@ do_connect_by_string (void *cls, | |||
930 | search_timeout_task = GNUNET_SCHEDULER_add_delayed (search_timeout, | 930 | search_timeout_task = GNUNET_SCHEDULER_add_delayed (search_timeout, |
931 | &do_connect_by_string_timeout, NULL); | 931 | &do_connect_by_string_timeout, NULL); |
932 | for (i = 0; i < SEARCHES_IN_PARALLEL; i++) | 932 | for (i = 0; i < SEARCHES_IN_PARALLEL; i++) |
933 | GNUNET_SCHEDULER_add_now (&find_next_string, NULL); | 933 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &find_next_string, NULL); |
934 | } | 934 | } |
935 | 935 | ||
936 | 936 | ||
@@ -1049,7 +1049,7 @@ arm_da (void *cls, void *op_result) | |||
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | static void | 1051 | static void |
1052 | regexprofiler_start_cb (void *cls, struct GNUNET_ARM_Handle *arm, | 1052 | arm_start_cb (void *cls, struct GNUNET_ARM_Handle *arm, |
1053 | enum GNUNET_ARM_RequestStatus rs, const char *service, | 1053 | enum GNUNET_ARM_RequestStatus rs, const char *service, |
1054 | enum GNUNET_ARM_Result result) | 1054 | enum GNUNET_ARM_Result result) |
1055 | { | 1055 | { |
@@ -1061,36 +1061,47 @@ regexprofiler_start_cb (void *cls, struct GNUNET_ARM_Handle *arm, | |||
1061 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "ARM request was not sent: %u\n", rs); | 1061 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "ARM request was not sent: %u\n", rs); |
1062 | GNUNET_abort (); | 1062 | GNUNET_abort (); |
1063 | } | 1063 | } |
1064 | else if (result != GNUNET_ARM_RESULT_STARTING) | 1064 | switch (result) |
1065 | { | 1065 | { |
1066 | /* FIXME: maybe check for other acceptable results (already starting, | 1066 | /** |
1067 | * already started)? | 1067 | * Asked to start it, but it's already starting. |
1068 | */ | 1068 | */ |
1069 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "ARM failed to start regexprofiler: %u\n", result); | 1069 | case GNUNET_ARM_RESULT_IS_STARTING_ALREADY: |
1070 | GNUNET_abort (); | 1070 | GNUNET_break (0); /* Shouldn't be starting, however it's not fatal. */ |
1071 | } | 1071 | /* fallthrough */ |
1072 | GNUNET_TESTBED_operation_done (peer->op_handle); | 1072 | |
1073 | peer->op_handle = NULL; | 1073 | /** |
1074 | * Service is currently being started (due to client request). | ||
1075 | */ | ||
1076 | case GNUNET_ARM_RESULT_STARTING: | ||
1077 | GNUNET_TESTBED_operation_done (peer->op_handle); | ||
1078 | peer->op_handle = NULL; | ||
1079 | |||
1080 | if (peer_cnt < (num_peers - 1)) | ||
1081 | { | ||
1082 | next_p = (++peer_cnt % num_peers); | ||
1083 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply( | ||
1084 | GNUNET_TIME_UNIT_MILLISECONDS, | ||
1085 | 1000), | ||
1086 | &announce_next_regex, | ||
1087 | (void *) (long) next_p); | ||
1088 | } | ||
1089 | else | ||
1090 | { | ||
1091 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1092 | "All daemons started." | ||
1093 | " Waiting %s to start string searches\n", | ||
1094 | GNUNET_STRINGS_relative_time_to_string (search_delay, | ||
1095 | GNUNET_NO)); | ||
1096 | GNUNET_SCHEDULER_add_delayed (search_delay, | ||
1097 | do_connect_by_string, | ||
1098 | NULL); | ||
1099 | } | ||
1100 | break; | ||
1074 | 1101 | ||
1075 | if (peer_cnt < (num_peers - 1)) | 1102 | default: |
1076 | { | 1103 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "ARM returned %d\n", result); |
1077 | next_p = (++peer_cnt % num_peers); | 1104 | GNUNET_abort (); |
1078 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply( | ||
1079 | GNUNET_TIME_UNIT_MILLISECONDS, | ||
1080 | 400), | ||
1081 | &announce_next_regex, | ||
1082 | (void *) (long) next_p); | ||
1083 | } | ||
1084 | else | ||
1085 | { | ||
1086 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1087 | "All daemons started." | ||
1088 | " Waiting %s to start string searches\n", | ||
1089 | GNUNET_STRINGS_relative_time_to_string (search_delay, | ||
1090 | GNUNET_NO)); | ||
1091 | GNUNET_SCHEDULER_add_delayed (search_delay, | ||
1092 | do_connect_by_string, | ||
1093 | NULL); | ||
1094 | } | 1105 | } |
1095 | } | 1106 | } |
1096 | 1107 | ||
@@ -1121,9 +1132,9 @@ arm_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
1121 | GNUNET_assert (peer->arm_handle == ca_result); | 1132 | GNUNET_assert (peer->arm_handle == ca_result); |
1122 | 1133 | ||
1123 | GNUNET_ARM_request_service_start (ca_result, "regexprofiler", | 1134 | GNUNET_ARM_request_service_start (ca_result, "regexprofiler", |
1124 | GNUNET_OS_INHERIT_STD_NONE, | 1135 | GNUNET_OS_INHERIT_STD_NONE, |
1125 | GNUNET_TIME_UNIT_FOREVER_REL, | 1136 | GNUNET_TIME_UNIT_FOREVER_REL, |
1126 | regexprofiler_start_cb, cls); | 1137 | arm_start_cb, cls); |
1127 | } | 1138 | } |
1128 | 1139 | ||
1129 | 1140 | ||
@@ -1596,7 +1607,7 @@ controller_event_cb (void *cls, | |||
1596 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Establishing links ."); | 1607 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Establishing links ."); |
1597 | else | 1608 | else |
1598 | { | 1609 | { |
1599 | printf ("."); | 1610 | printf (".");fflush (stdout); |
1600 | } | 1611 | } |
1601 | if (++established_links == num_links) | 1612 | if (++established_links == num_links) |
1602 | { | 1613 | { |