- case STATE_PEERS_LINKING:
- switch (event->type)
- {
- static unsigned int established_links;
- case GNUNET_TESTBED_ET_OPERATION_FINISHED:
- /* Control reaches here when a peer linking operation fails */
- if (NULL != event->details.operation_finished.emsg)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("An operation has failed while linking\n"));
- printf ("F%u/%u(%s)",
- retry_links + 1, established_links + 1,
- event->details.operation_finished.emsg);
- fflush (stdout);
- retry_links++;
- }
- /* We do no retries, consider this link as established */
- /* break; */
- case GNUNET_TESTBED_ET_CONNECT:
- {
- char output_buffer[1024];
- size_t size;
-
- if (0 == established_links)
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Establishing links .");
- else
- {
- printf (".");fflush (stdout);
- }
- if (++established_links == num_links)
- {
- prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "%u links established in %s\n",
- num_links,
- GNUNET_STRINGS_relative_time_to_string (prof_time,
- GNUNET_NO));
- prof_time = GNUNET_TIME_relative_divide(prof_time, num_links);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Average of %s per connection\n",
- GNUNET_STRINGS_relative_time_to_string (prof_time,
- GNUNET_NO));
- result = GNUNET_OK;
- GNUNET_free (peer_handles);
-
- if (NULL != data_file)
- {
- size =
- GNUNET_snprintf (output_buffer,
- sizeof (output_buffer),
- "# of peers: %u\n# of links established: %u\n"
- "Time to establish links: %s\n"
- "Linking failures: %u\n"
- "path compression length: %u\n"
- "# of search strings: %u\n",
- num_peers,
- (established_links - retry_links),
- GNUNET_STRINGS_relative_time_to_string (prof_time,
- GNUNET_NO),
- retry_links,
- max_path_compression,
- num_search_strings);
-
- if (size != GNUNET_DISK_file_write (data_file, output_buffer, size))
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "\nWaiting %s before starting to announce.\n",
- GNUNET_STRINGS_relative_time_to_string (search_delay,
- GNUNET_NO));
- state = STATE_SEARCH_REGEX;
- search_task = GNUNET_SCHEDULER_add_delayed (search_delay,
- &do_announce, NULL);
- }
- }
- break;
- default:
- GNUNET_assert (0);
- }
- break;
- case STATE_SEARCH_REGEX:
- {
- /* Handled in service connect callback */
- break;
- }