aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-11-05 12:56:48 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-11-05 12:56:48 +0000
commita93e0cf3ac2da8fa1091d12620c603c69d04246a (patch)
tree8c322c543190523f03775a4647a4975b8a9a3ad9 /src
parentb15cbf07c97038fdaf066cca732c01a142833b2b (diff)
downloadgnunet-a93e0cf3ac2da8fa1091d12620c603c69d04246a.tar.gz
gnunet-a93e0cf3ac2da8fa1091d12620c603c69d04246a.zip
- removed unused function / var
- indentation
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-regex-profiler.c347
1 files changed, 148 insertions, 199 deletions
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c
index d45d8a650..ac7b19fce 100644
--- a/src/mesh/gnunet-regex-profiler.c
+++ b/src/mesh/gnunet-regex-profiler.c
@@ -257,11 +257,6 @@ static struct GNUNET_TIME_Absolute prof_start_time;
257static struct GNUNET_TIME_Relative prof_time; 257static struct GNUNET_TIME_Relative prof_time;
258 258
259/** 259/**
260 * Current peer id
261 */
262static unsigned int peer_id;
263
264/**
265 * Number of peers to be started by the profiler 260 * Number of peers to be started by the profiler
266 */ 261 */
267static unsigned int num_peers; 262static unsigned int num_peers;
@@ -470,17 +465,17 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
470 { 465 {
471 prof_time = GNUNET_TIME_absolute_get_duration (peer->prof_start_time); 466 prof_time = GNUNET_TIME_absolute_get_duration (peer->prof_start_time);
472 size = 467 size =
473 GNUNET_snprintf (output_buffer, 468 GNUNET_snprintf (output_buffer,
474 sizeof (output_buffer), 469 sizeof (output_buffer),
475 "Search string not found: %s (%d)\nOn peer: %u (%p)\nWith policy file: %s\nAfter: %s\n", 470 "Search string not found: %s (%d)\nOn peer: %u (%p)\nWith policy file: %s\nAfter: %s\n",
476 peer->search_str, 471 peer->search_str,
477 peer->search_str_matched, 472 peer->search_str_matched,
478 peer->id, 473 peer->id,
479 peer, 474 peer,
480 peer->policy_file, 475 peer->policy_file,
481 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); 476 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO));
482 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) 477 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size))
483 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); 478 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
484 } 479 }
485 480
486 if (NULL != peers[peer_cnt].mesh_op_handle) 481 if (NULL != peers[peer_cnt].mesh_op_handle)
@@ -492,8 +487,8 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
492 if (NULL != data_file) 487 if (NULL != data_file)
493 GNUNET_DISK_file_close (data_file); 488 GNUNET_DISK_file_close (data_file);
494 489
495 for (search_str_cnt = 0; 490 for (search_str_cnt = 0;
496 search_str_cnt < num_search_strings && NULL != search_strings; 491 search_str_cnt < num_search_strings && NULL != search_strings;
497 search_str_cnt++) 492 search_str_cnt++)
498 { 493 {
499 GNUNET_free_non_null (search_strings[search_str_cnt]); 494 GNUNET_free_non_null (search_strings[search_str_cnt]);
@@ -685,7 +680,7 @@ stats_connect_cb (void *cls,
685 680
686 peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle, 681 peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle,
687 NULL, 682 NULL,
688 &mesh_peer_connect_handler, 683 &mesh_peer_connect_handler,
689 &mesh_peer_disconnect_handler, 684 &mesh_peer_disconnect_handler,
690 peer); 685 peer);
691 686
@@ -702,52 +697,6 @@ stats_connect_cb (void *cls,
702/******************************************************************************/ 697/******************************************************************************/
703 698
704/** 699/**
705 * Method called whenever another peer has added us to a tunnel
706 * the other peer initiated.
707 * Only called (once) upon reception of data with a message type which was
708 * subscribed to in GNUNET_MESH_connect. A call to GNUNET_MESH_tunnel_destroy
709 * causes te tunnel to be ignored and no further notifications are sent about
710 * the same tunnel.
711 *
712 * @param cls closure
713 * @param tunnel new handle to the tunnel
714 * @param initiator peer that started the tunnel
715 * @param atsi performance information for the tunnel
716 * @return initial tunnel context for the tunnel
717 * (can be NULL -- that's not an error)
718 */
719static void *
720mesh_inbound_tunnel_handler (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
721 const struct GNUNET_PeerIdentity *initiator,
722 const struct GNUNET_ATS_Information *atsi)
723{
724 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh inbound tunnel handler.\n");
725
726 return NULL;
727}
728
729
730/**
731 * Function called whenever an inbound tunnel is destroyed. Should clean up
732 * any associated state. This function is NOT called if the client has
733 * explicitly asked for the tunnel to be destroyed using
734 * GNUNET_MESH_tunnel_destroy. It must NOT call GNUNET_MESH_tunnel_destroy on
735 * the tunnel.
736 *
737 * @param cls closure (set from GNUNET_MESH_connect)
738 * @param tunnel connection to the other end (henceforth invalid)
739 * @param tunnel_ctx place where local state associated
740 * with the tunnel is stored
741 */
742static void
743mesh_tunnel_end_handler (void *cls, const struct GNUNET_MESH_Tunnel *tunnel,
744 void *tunnel_ctx)
745{
746 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh tunnel end handler.\n");
747}
748
749
750/**
751 * Method called whenever a peer has disconnected from the tunnel. 700 * Method called whenever a peer has disconnected from the tunnel.
752 * Implementations of this callback must NOT call 701 * Implementations of this callback must NOT call
753 * GNUNET_MESH_tunnel_destroy immediately, but instead schedule those 702 * GNUNET_MESH_tunnel_destroy immediately, but instead schedule those
@@ -791,7 +740,7 @@ mesh_peer_connect_handler (void *cls,
791 peer->search_str, peer->id, peers_found, num_search_strings); 740 peer->search_str, peer->id, peers_found, num_search_strings);
792 741
793 printf ("String matching timed out for string %s on peer %u (%i/%i)\n", 742 printf ("String matching timed out for string %s on peer %u (%i/%i)\n",
794 peer->search_str, peer->id, peers_found, num_search_strings); 743 peer->search_str, peer->id, peers_found, num_search_strings);
795 744
796 peer->search_str_matched = GNUNET_SYSERR; 745 peer->search_str_matched = GNUNET_SYSERR;
797 } 746 }
@@ -804,8 +753,8 @@ mesh_peer_connect_handler (void *cls,
804 peers_found, num_search_strings); 753 peers_found, num_search_strings);
805 754
806 printf ("String %s successfully matched on peer %u after %s (%i/%i)\n", 755 printf ("String %s successfully matched on peer %u after %s (%i/%i)\n",
807 peer->search_str, peer->id, GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), 756 peer->search_str, peer->id, GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO),
808 peers_found, num_search_strings); 757 peers_found, num_search_strings);
809 fflush (stdout); 758 fflush (stdout);
810 759
811 peer->search_str_matched = GNUNET_YES; 760 peer->search_str_matched = GNUNET_YES;
@@ -830,7 +779,7 @@ mesh_peer_connect_handler (void *cls,
830 if (NULL == peer->stats_handle) 779 if (NULL == peer->stats_handle)
831 { 780 {
832 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 781 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
833 "Cannot get statistics for peer %u, stats handle is NULL!\n"); 782 "Cannot get statistics for peer %u, stats handle is NULL!\n");
834 return; 783 return;
835 } 784 }
836 785
@@ -947,7 +896,7 @@ do_connect_by_string (void *cls,
947 */ 896 */
948static void 897static void
949do_mesh_op_done (void *cls, 898do_mesh_op_done (void *cls,
950 const struct GNUNET_SCHEDULER_TaskContext * tc) 899 const struct GNUNET_SCHEDULER_TaskContext * tc)
951{ 900{
952 struct RegexPeer *peer = cls; 901 struct RegexPeer *peer = cls;
953 static unsigned int peer_cnt; 902 static unsigned int peer_cnt;
@@ -958,13 +907,13 @@ do_mesh_op_done (void *cls,
958 { 907 {
959 peers[peer_cnt].mesh_op_handle = 908 peers[peer_cnt].mesh_op_handle =
960 GNUNET_TESTBED_service_connect (NULL, 909 GNUNET_TESTBED_service_connect (NULL,
961 peers[peer_cnt].peer_handle, 910 peers[peer_cnt].peer_handle,
962 "mesh", 911 "mesh",
963 &mesh_connect_cb, 912 &mesh_connect_cb,
964 &peers[peer_cnt], 913 &peers[peer_cnt],
965 &mesh_ca, 914 &mesh_ca,
966 &mesh_da, 915 &mesh_da,
967 &peers[peer_cnt]); 916 &peers[peer_cnt]);
968 } 917 }
969} 918}
970 919
@@ -993,7 +942,7 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
993 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Mesh connect failed: %s\n", emsg); 942 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Mesh connect failed: %s\n", emsg);
994 GNUNET_assert (0); 943 GNUNET_assert (0);
995 } 944 }
996 945
997 GNUNET_assert (peer->mesh_handle != NULL); 946 GNUNET_assert (peer->mesh_handle != NULL);
998 GNUNET_assert (peer->mesh_op_handle == op); 947 GNUNET_assert (peer->mesh_op_handle == op);
999 GNUNET_assert (peer->mesh_handle == ca_result); 948 GNUNET_assert (peer->mesh_handle == ca_result);
@@ -1006,72 +955,72 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
1006 static unsigned int num_files_announced; 955 static unsigned int num_files_announced;
1007 956
1008 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 957 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1009 "Announcing regexes for peer %u with file %s\n", 958 "Announcing regexes for peer %u with file %s\n",
1010 peer->id, peer->policy_file); 959 peer->id, peer->policy_file);
1011 960
1012 if (GNUNET_YES != GNUNET_DISK_file_test (peer->policy_file)) 961 if (GNUNET_YES != GNUNET_DISK_file_test (peer->policy_file))
1013 { 962 {
1014 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 963 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1015 "Could not find policy file %s\n", peer->policy_file); 964 "Could not find policy file %s\n", peer->policy_file);
1016 return; 965 return;
1017 } 966 }
1018 if (GNUNET_OK != GNUNET_DISK_file_size (peer->policy_file, &filesize, GNUNET_YES, GNUNET_YES)) 967 if (GNUNET_OK != GNUNET_DISK_file_size (peer->policy_file, &filesize, GNUNET_YES, GNUNET_YES))
1019 filesize = 0; 968 filesize = 0;
1020 if (0 == filesize) 969 if (0 == filesize)
1021 { 970 {
1022 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Policy file %s is empty.\n", peer->policy_file); 971 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Policy file %s is empty.\n", peer->policy_file);
1023 return; 972 return;
1024 } 973 }
1025 data = GNUNET_malloc (filesize); 974 data = GNUNET_malloc (filesize);
1026 if (filesize != GNUNET_DISK_fn_read (peer->policy_file, data, filesize)) 975 if (filesize != GNUNET_DISK_fn_read (peer->policy_file, data, filesize))
1027 { 976 {
1028 GNUNET_free (data); 977 GNUNET_free (data);
1029 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not read policy file %s.\n", 978 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not read policy file %s.\n",
1030 peer->policy_file); 979 peer->policy_file);
1031 return; 980 return;
1032 } 981 }
1033 buf = data; 982 buf = data;
1034 offset = 0; 983 offset = 0;
1035 regex = NULL; 984 regex = NULL;
1036 while (offset < (filesize - 1)) 985 while (offset < (filesize - 1))
1037 { 986 {
1038 offset++; 987 offset++;
1039 if (((data[offset] == '\n')) && (buf != &data[offset])) 988 if (((data[offset] == '\n')) && (buf != &data[offset]))
1040 { 989 {
1041 data[offset] = '\0'; 990 data[offset] = '\0';
1042 regex = buf; 991 regex = buf;
1043 GNUNET_assert (NULL != regex); 992 GNUNET_assert (NULL != regex);
1044 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s on peer %u \n", 993 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s on peer %u \n",
1045 regex, peer->id); 994 regex, peer->id);
1046 GNUNET_MESH_announce_regex (peer->mesh_handle, regex, max_path_compression); 995 GNUNET_MESH_announce_regex (peer->mesh_handle, regex, max_path_compression);
1047 buf = &data[offset + 1]; 996 buf = &data[offset + 1];
1048 } 997 }
1049 else if ((data[offset] == '\n') || (data[offset] == '\0')) 998 else if ((data[offset] == '\n') || (data[offset] == '\0'))
1050 buf = &data[offset + 1]; 999 buf = &data[offset + 1];
1051 } 1000 }
1052 GNUNET_free (data); 1001 GNUNET_free (data);
1053 1002
1054 GNUNET_SCHEDULER_add_delayed (mesh_done_delay, &do_mesh_op_done, peer); 1003 GNUNET_SCHEDULER_add_delayed (mesh_done_delay, &do_mesh_op_done, peer);
1055 1004
1056 if (++num_files_announced == num_peers) 1005 if (++num_files_announced == num_peers)
1057 { 1006 {
1058 state = STATE_SEARCH_REGEX; 1007 state = STATE_SEARCH_REGEX;
1059 1008
1060 prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); 1009 prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
1061 1010
1062 printf ("All files announced in %s.\n", 1011 printf ("All files announced in %s.\n",
1063 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); 1012 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO));
1064 printf ("Waiting %s before starting to search.\n", 1013 printf ("Waiting %s before starting to search.\n",
1065 GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES)); 1014 GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES));
1066 fflush (stdout); 1015 fflush (stdout);
1067 1016
1068 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1017 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1069 "All regexes announced in %s. Waiting %s before starting to search.\n", 1018 "All regexes announced in %s. Waiting %s before starting to search.\n",
1070 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), 1019 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO),
1071 GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_NO)); 1020 GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_NO));
1072 1021
1073 search_task = GNUNET_SCHEDULER_add_delayed (search_delay, 1022 search_task = GNUNET_SCHEDULER_add_delayed (search_delay,
1074 &do_connect_by_string, NULL); 1023 &do_connect_by_string, NULL);
1075 } 1024 }
1076 break; 1025 break;
1077 } 1026 }
@@ -1079,14 +1028,14 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
1079 { 1028 {
1080 /* First connect to the stats service, then start to search */ 1029 /* First connect to the stats service, then start to search */
1081 peer->stats_op_handle = 1030 peer->stats_op_handle =
1082 GNUNET_TESTBED_service_connect (NULL, 1031 GNUNET_TESTBED_service_connect (NULL,
1083 peers->peer_handle, 1032 peers->peer_handle,
1084 "statistics", 1033 "statistics",
1085 &stats_connect_cb, 1034 &stats_connect_cb,
1086 peer, 1035 peer,
1087 &stats_ca, 1036 &stats_ca,
1088 &stats_da, 1037 &stats_da,
1089 peer); 1038 peer);
1090 break; 1039 break;
1091 } 1040 }
1092 default: 1041 default:
@@ -1163,7 +1112,7 @@ mesh_da (void *cls, void *op_result)
1163 */ 1112 */
1164static void 1113static void
1165do_configure_topology (void *cls, 1114do_configure_topology (void *cls,
1166 const struct GNUNET_SCHEDULER_TaskContext * tc) 1115 const struct GNUNET_SCHEDULER_TaskContext * tc)
1167{ 1116{
1168 /* 1117 /*
1169 if (0 == linking_factor) 1118 if (0 == linking_factor)
@@ -1177,14 +1126,14 @@ do_configure_topology (void *cls,
1177 prof_start_time = GNUNET_TIME_absolute_get (); 1126 prof_start_time = GNUNET_TIME_absolute_get ();
1178 topology_op = 1127 topology_op =
1179 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, 1128 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles,
1180 GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, 1129 GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
1181 num_links, 1130 num_links,
1182 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY, 1131 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
1183 GNUNET_TESTBED_TOPOLOGY_OPTION_END); 1132 GNUNET_TESTBED_TOPOLOGY_OPTION_END);
1184 if (NULL == topology_op) 1133 if (NULL == topology_op)
1185 { 1134 {
1186 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1135 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1187 "Cannot create topology, op handle was NULL\n"); 1136 "Cannot create topology, op handle was NULL\n");
1188 GNUNET_assert (0); 1137 GNUNET_assert (0);
1189 } 1138 }
1190} 1139}
@@ -1232,11 +1181,11 @@ peer_churn_cb (void *cls, const char *emsg)
1232 peer_handles[peer_cnt] = peers[peer_cnt].peer_handle; 1181 peer_handles[peer_cnt] = peers[peer_cnt].peer_handle;
1233 1182
1234 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1183 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1235 "Waiting %s before starting to link peers\n", 1184 "Waiting %s before starting to link peers\n",
1236 GNUNET_STRINGS_relative_time_to_string (conf_topo_delay, GNUNET_YES)); 1185 GNUNET_STRINGS_relative_time_to_string (conf_topo_delay, GNUNET_YES));
1237 1186
1238 printf ("Waiting %s before starting to link peers\n", 1187 printf ("Waiting %s before starting to link peers\n",
1239 GNUNET_STRINGS_relative_time_to_string (conf_topo_delay, GNUNET_YES)); 1188 GNUNET_STRINGS_relative_time_to_string (conf_topo_delay, GNUNET_YES));
1240 fflush (stdout); 1189 fflush (stdout);
1241 1190
1242 state = STATE_PEERS_LINKING; 1191 state = STATE_PEERS_LINKING;
@@ -1366,7 +1315,7 @@ controller_event_cb (void *cls,
1366 case GNUNET_TESTBED_ET_OPERATION_FINISHED: 1315 case GNUNET_TESTBED_ET_OPERATION_FINISHED:
1367 { 1316 {
1368 static unsigned int slaves_started; 1317 static unsigned int slaves_started;
1369 unsigned int peer_cnt; 1318 unsigned int peer_cnt;
1370 1319
1371 dll_op = event->details.operation_finished.op_cls; 1320 dll_op = event->details.operation_finished.op_cls;
1372 GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); 1321 GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
@@ -1393,33 +1342,33 @@ controller_event_cb (void *cls,
1393 prof_start_time = GNUNET_TIME_absolute_get (); 1342 prof_start_time = GNUNET_TIME_absolute_get ();
1394 1343
1395 if (-1 == (ret = GNUNET_DISK_directory_scan (policy_dir, 1344 if (-1 == (ret = GNUNET_DISK_directory_scan (policy_dir,
1396 NULL, 1345 NULL,
1397 NULL))) 1346 NULL)))
1398 { 1347 {
1399 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1348 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1400 _("No files found in `%s'\n"), 1349 _("No files found in `%s'\n"),
1401 policy_dir); 1350 policy_dir);
1402 GNUNET_SCHEDULER_shutdown (); 1351 GNUNET_SCHEDULER_shutdown ();
1403 return; 1352 return;
1404 } 1353 }
1405 num_peers = (unsigned int) ret; 1354 num_peers = (unsigned int) ret;
1406 peers = GNUNET_malloc (sizeof (struct RegexPeer) * num_peers); 1355 peers = GNUNET_malloc (sizeof (struct RegexPeer) * num_peers);
1407 1356
1408 /* Initialize peers */ 1357 /* Initialize peers */
1409 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) 1358 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
1410 { 1359 {
1411 struct RegexPeer *peer = &peers[peer_cnt]; 1360 struct RegexPeer *peer = &peers[peer_cnt];
1412 peer->id = peer_cnt; 1361 peer->id = peer_cnt;
1413 peer->policy_file = NULL; 1362 peer->policy_file = NULL;
1414 /* Do not start peers on hosts[0] (master controller) */ 1363 /* Do not start peers on hosts[0] (master controller) */
1415 peer->host_handle = hosts[1 + (peer_cnt % (num_hosts -1))]; 1364 peer->host_handle = hosts[1 + (peer_cnt % (num_hosts -1))];
1416 peer->mesh_handle = NULL; 1365 peer->mesh_handle = NULL;
1417 peer->mesh_tunnel_handle = NULL; 1366 peer->mesh_tunnel_handle = NULL;
1418 peer->stats_handle = NULL; 1367 peer->stats_handle = NULL;
1419 peer->stats_op_handle = NULL; 1368 peer->stats_op_handle = NULL;
1420 peer->search_str = NULL; 1369 peer->search_str = NULL;
1421 peer->search_str_matched = GNUNET_NO; 1370 peer->search_str_matched = GNUNET_NO;
1422 } 1371 }
1423 1372
1424 GNUNET_DISK_directory_scan (policy_dir, 1373 GNUNET_DISK_directory_scan (policy_dir,
1425 &policy_filename_cb, 1374 &policy_filename_cb,
@@ -1452,18 +1401,18 @@ controller_event_cb (void *cls,
1452 if (NULL != event->details.operation_finished.emsg) 1401 if (NULL != event->details.operation_finished.emsg)
1453 { 1402 {
1454 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1403 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1455 _("An operation has failed while linking\n")); 1404 _("An operation has failed while linking\n"));
1456 printf ("F"); 1405 printf ("F");
1457 fflush (stdout); 1406 fflush (stdout);
1458 retry_links++; 1407 retry_links++;
1459 } 1408 }
1460 /* We do no retries, consider this link as established */ 1409 /* We do no retries, consider this link as established */
1461 /* break; */ 1410 /* break; */
1462 case GNUNET_TESTBED_ET_CONNECT: 1411 case GNUNET_TESTBED_ET_CONNECT:
1463 { 1412 {
1464 char output_buffer[512]; 1413 char output_buffer[512];
1465 size_t size; 1414 size_t size;
1466 1415
1467 if (0 == established_links) 1416 if (0 == established_links)
1468 printf ("Establishing links ."); 1417 printf ("Establishing links .");
1469 else 1418 else
@@ -1476,46 +1425,46 @@ controller_event_cb (void *cls,
1476 fflush (stdout); 1425 fflush (stdout);
1477 prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); 1426 prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
1478 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1427 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1479 "%u links established in %s\n", 1428 "%u links established in %s\n",
1480 num_links, 1429 num_links,
1481 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); 1430 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO));
1482 result = GNUNET_OK; 1431 result = GNUNET_OK;
1483 GNUNET_free (peer_handles); 1432 GNUNET_free (peer_handles);
1484 1433
1485 if (NULL != data_file) 1434 if (NULL != data_file)
1486 { 1435 {
1487 size = 1436 size =
1488 GNUNET_snprintf (output_buffer, 1437 GNUNET_snprintf (output_buffer,
1489 sizeof (output_buffer), 1438 sizeof (output_buffer),
1490 "# of peers: %u\n# of links established: %u\n" 1439 "# of peers: %u\n# of links established: %u\n"
1491 "Time to establish links: %s\nLinking failures: %u\n" 1440 "Time to establish links: %s\nLinking failures: %u\n"
1492 "path compression length: %u\n# of search strings: %u\n", 1441 "path compression length: %u\n# of search strings: %u\n",
1493 num_peers, 1442 num_peers,
1494 (established_links - cont_fails), 1443 (established_links - cont_fails),
1495 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), 1444 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO),
1496 cont_fails, 1445 cont_fails,
1497 max_path_compression, 1446 max_path_compression,
1498 num_search_strings); 1447 num_search_strings);
1499 1448
1500 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) 1449 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size))
1501 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); 1450 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
1502 } 1451 }
1503 1452
1504 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1453 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1505 "Connecting to mesh service and start announcing regex...\n"); 1454 "Connecting to mesh service and start announcing regex...\n");
1506 printf ("\nStarting to connect to mesh services and announce regex\n"); 1455 printf ("\nStarting to connect to mesh services and announce regex\n");
1507 fflush (stdout); 1456 fflush (stdout);
1508 1457
1509 prof_start_time = GNUNET_TIME_absolute_get (); 1458 prof_start_time = GNUNET_TIME_absolute_get ();
1510 peers[0].mesh_op_handle = 1459 peers[0].mesh_op_handle =
1511 GNUNET_TESTBED_service_connect (NULL, 1460 GNUNET_TESTBED_service_connect (NULL,
1512 peers[0].peer_handle, 1461 peers[0].peer_handle,
1513 "mesh", 1462 "mesh",
1514 &mesh_connect_cb, 1463 &mesh_connect_cb,
1515 &peers[0], 1464 &peers[0],
1516 &mesh_ca, 1465 &mesh_ca,
1517 &mesh_da, 1466 &mesh_da,
1518 &peers[0]); 1467 &peers[0]);
1519 state = STATE_ANNOUNCE_REGEX; 1468 state = STATE_ANNOUNCE_REGEX;
1520 } 1469 }
1521 } 1470 }
@@ -1542,7 +1491,7 @@ controller_event_cb (void *cls,
1542 break; 1491 break;
1543 default: 1492 default:
1544 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1493 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1545 "Unexpected controller_cb with state %i!\n", state); 1494 "Unexpected controller_cb with state %i!\n", state);
1546 } 1495 }
1547 GNUNET_assert (0); 1496 GNUNET_assert (0);
1548 } 1497 }