#include "platform.h"
#include "gnunet_applications.h"
#include "gnunet_util_lib.h"
-#include "gnunet_regex_lib.h"
+#include "regex_internal_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_dht_service.h"
#include "gnunet_testbed_service.h"
/**
* Handle to a running regex search.
*/
- struct GNUNET_REGEX_search_handle *search_handle;
+ struct REGEX_INTERNAL_Search *search_handle;
/**
* Testbed operation handle for DHT.
{
struct GNUNET_TIME_Relative delay = { 100 };
shutdown_task = GNUNET_SCHEDULER_add_delayed (delay, &do_shutdown, NULL);
+ result = GNUNET_OK;
}
else
{
* Method called when we've found a peer that announced a regex
* that matches our search string. Now get the statistics.
*
- * @param cls Closure provided in GNUNET_REGEX_search.
+ * @param cls Closure provided in REGEX_INTERNAL_search.
* @param id Peer providing a regex that matches the string.
* @param get_path Path of the get request.
* @param get_path_length Lenght of get_path.
GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO));
if (GNUNET_SCHEDULER_NO_TASK != search_timeout_task)
+ {
GNUNET_SCHEDULER_cancel (search_timeout_task);
+ search_timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Collecting stats and shutting down.\n");
GNUNET_SCHEDULER_add_now (&do_collect_stats, NULL);
{
struct RegexPeer *peer;
- if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) ||
- next_search >= num_peers)
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
+ if (next_search >= num_peers)
+ {
+ if (strings_found != num_peers)
+ {
+ struct GNUNET_TIME_Relative new_delay;
+ if (GNUNET_SCHEDULER_NO_TASK != search_timeout_task)
+ GNUNET_SCHEDULER_cancel (search_timeout_task);
+ new_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15);
+ search_timeout_task = GNUNET_SCHEDULER_add_delayed (new_delay,
+ &search_timed_out,
+ NULL);
+ }
+ return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting daemon %u\n", next_search);
peer = &peers[next_search];
GNUNET_assert (peer->dht_handle == ca_result);
peer->search_str_matched = GNUNET_NO;
- peer->search_handle = GNUNET_REGEX_search (peer->dht_handle,
+ peer->search_handle = REGEX_INTERNAL_search (peer->dht_handle,
peer->search_str,
®ex_found_handler, peer,
NULL);
if (NULL != peer->search_handle)
{
- GNUNET_REGEX_search_cancel (peer->search_handle);
+ REGEX_INTERNAL_search_cancel (peer->search_handle);
peer->search_handle = NULL;
}
*
* @param cls NULL
* @param num_peers_ number of peers in 'peers'
- * @param peers handle to peers run in the testbed. NULL upon timeout (see
+ * @param testbed_peers handle to peers run in the testbed. NULL upon timeout (see
* GNUNET_TESTBED_test_run()).
* @param links_succeeded the number of overlay link connection attempts that
* succeeded
{
peers[i].peer_handle = testbed_peers[i];
}
- GNUNET_SCHEDULER_add_now (&do_announce, NULL);
+ if (GNUNET_NO ==
+ GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT", "DISABLE_TRY_CONNECT"))
+ {
+ struct GNUNET_TIME_Relative settle_time;
+
+ settle_time =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
+ 10 * num_peers);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Waiting for DHT for %s to settle new connections.\n\n",
+ GNUNET_STRINGS_relative_time_to_string(settle_time, GNUNET_NO));
+ GNUNET_SCHEDULER_add_delayed (settle_time, &do_announce, NULL);
+ }
+ else
+ {
+ GNUNET_SCHEDULER_add_now (&do_announce, NULL);
+ }
search_timeout_task =
GNUNET_SCHEDULER_add_delayed (search_timeout_time, &search_timed_out, NULL);
}
{
unsigned int nsearchstrs;
unsigned int i;
+ struct GNUNET_TIME_Relative abort_time;
in_shutdown = GNUNET_NO;
if (num_peers != nsearchstrs)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Error loading search strings."
- "Given file does not contain enough strings. Exiting.\n"));
+ "Error loading search strings.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "File (%s) does not contain enough strings (%u/%u).\n",
+ strings_file, nsearchstrs, num_peers);
shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
return;
}
peers[i].id = i;
}
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ "TESTBED", "OVERLAY_RANDOM_LINKS",
+ num_peers * 20);
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ "DHT", "FORCE_NSE",
+ (long long unsigned)
+ (log (num_peers) / log (2.0)));
event_mask = 0LL;
/* For feedback about the start process activate these and pass master_cb */
event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START);
NULL, /* master_controller_cb cls */
&test_master,
NULL); /* test_master cls */
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_time (cfg, "TESTBED",
+ "SETUP_TIMEOUT",
+ &abort_time))
+ {
+ abort_time =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15);
+ }
+ abort_time = GNUNET_TIME_relative_add (abort_time, GNUNET_TIME_UNIT_MINUTES);
abort_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MINUTES, 15),
+ GNUNET_SCHEDULER_add_delayed (abort_time,
&do_abort,
(void*) __LINE__);
}
GNUNET_YES, &GNUNET_GETOPT_set_filename, &strings_file},
{'H', "hosts-file", "FILENAME",
gettext_noop ("name of file with hosts' names"),
- GNUNET_NO, &GNUNET_GETOPT_set_filename, &hosts_file},
+ GNUNET_YES, &GNUNET_GETOPT_set_filename, &hosts_file},
GNUNET_GETOPT_OPTION_END
};
int ret;