aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-03-21 17:03:30 +0000
committerBart Polot <bart@net.in.tum.de>2013-03-21 17:03:30 +0000
commit3f3bc61d2002a4a69e98c60b8218cf05c6248859 (patch)
tree87b9432c519c9f14a36d70f704e85cb1edfc725f /src/regex
parent338678fcc6fccaf292d68413b6fe5ea33d83c49a (diff)
downloadgnunet-3f3bc61d2002a4a69e98c60b8218cf05c6248859.tar.gz
gnunet-3f3bc61d2002a4a69e98c60b8218cf05c6248859.zip
- sync wait period with deamon
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/gnunet-regex-profiler.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c
index 1c4e43f60..83b8ec50f 100644
--- a/src/regex/gnunet-regex-profiler.c
+++ b/src/regex/gnunet-regex-profiler.c
@@ -38,8 +38,6 @@
38 38
39#define FIND_TIMEOUT \ 39#define FIND_TIMEOUT \
40 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 90) 40 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 90)
41#define ANNOUNCE_TIME \
42 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 200)
43#define SEARCHES_IN_PARALLEL 100 41#define SEARCHES_IN_PARALLEL 100
44 42
45/** 43/**
@@ -143,7 +141,7 @@ struct RegexPeer
143 char *policy_file; 141 char *policy_file;
144 142
145 /** 143 /**
146 * Peers search string. 144 * Peer's search string.
147 */ 145 */
148 const char *search_str; 146 const char *search_str;
149 147
@@ -395,6 +393,11 @@ static unsigned int max_path_compression;
395 */ 393 */
396static char * regex_prefix; 394static char * regex_prefix;
397 395
396/**
397 * What's the maximum regex reannounce period.
398 */
399static struct GNUNET_TIME_Relative reannounce_period_max;
400
398 401
399/******************************************************************************/ 402/******************************************************************************/
400/****************************** DECLARATIONS ********************************/ 403/****************************** DECLARATIONS ********************************/
@@ -1103,7 +1106,9 @@ arm_start_cb (void *cls, struct GNUNET_ARM_Handle *arm,
1103 GNUNET_abort (); /* we ran out of peers, must be a bug */ 1106 GNUNET_abort (); /* we ran out of peers, must be a bug */
1104 } 1107 }
1105 peers[search_peer].search_str = search_strings[me]; 1108 peers[search_peer].search_str = search_strings[me];
1106 GNUNET_SCHEDULER_add_delayed (ANNOUNCE_TIME, 1109 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(
1110 reannounce_period_max,
1111 2),
1107 &find_string, 1112 &find_string,
1108 (void *) search_peer); 1113 (void *) search_peer);
1109 } 1114 }
@@ -2058,10 +2063,20 @@ run (void *cls, char *const *args, const char *cfgfile,
2058 shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 2063 shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
2059 return; 2064 return;
2060 } 2065 }
2066 cfg = GNUNET_CONFIGURATION_dup (config);
2067 if (GNUNET_OK !=
2068 GNUNET_CONFIGURATION_get_value_time (cfg, "REGEXPROFILER",
2069 "REANNOUNCE_PERIOD_MAX",
2070 &reannounce_period_max))
2071 {
2072 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2073 "reannounce_period_max not given. Using 10 minutes.\n");
2074 reannounce_period_max =
2075 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10);
2076 }
2061 unsigned int i; 2077 unsigned int i;
2062 for (i = 0; i < num_search_strings; i++) 2078 for (i = 0; i < num_search_strings; i++)
2063 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "search string: %s\n", search_strings[i]); 2079 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "search string: %s\n", search_strings[i]);
2064 cfg = GNUNET_CONFIGURATION_dup (config);
2065 abort_task = 2080 abort_task =
2066 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 2081 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
2067 (GNUNET_TIME_UNIT_SECONDS, 5), &do_abort, 2082 (GNUNET_TIME_UNIT_SECONDS, 5), &do_abort,