aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-10-29 16:41:36 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-10-29 16:41:36 +0000
commit4e03429725516bd3ab76977fe3004e57d5ed7b3f (patch)
tree634c964bfe309702e822fe38984a46900eca3660 /src
parent6035da499e4311aefda6f1c6ba1acef9cf3ded7e (diff)
downloadgnunet-4e03429725516bd3ab76977fe3004e57d5ed7b3f.tar.gz
gnunet-4e03429725516bd3ab76977fe3004e57d5ed7b3f.zip
sequential mesh service connects and regex announcing in regex profiler
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-regex-profiler.c482
1 files changed, 295 insertions, 187 deletions
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c
index 5e54ea3ba..97ca84ee4 100644
--- a/src/mesh/gnunet-regex-profiler.c
+++ b/src/mesh/gnunet-regex-profiler.c
@@ -93,6 +93,16 @@ enum State
93 STATE_PEERS_LINKING, 93 STATE_PEERS_LINKING,
94 94
95 /** 95 /**
96 * Announcing regexes
97 */
98 STATE_ANNOUNCE_REGEX,
99
100 /**
101 * Matching strings against announced regexes
102 */
103 STATE_SEARCH_REGEX,
104
105 /**
96 * Destroying peers; we can do this as the controller takes care of stopping a 106 * Destroying peers; we can do this as the controller takes care of stopping a
97 * peer if it is running 107 * peer if it is running
98 */ 108 */
@@ -353,6 +363,10 @@ static struct GNUNET_TIME_Relative announce_delay = { 10000 };
353 */ 363 */
354static unsigned int announce_batch_size; 364static unsigned int announce_batch_size;
355 365
366/**
367 * Delay before setting mesh service op as done.
368 */
369static struct GNUNET_TIME_Relative mesh_done_delay = { 1000 };
356 370
357/******************************************************************************/ 371/******************************************************************************/
358/****************************** DECLARATIONS ********************************/ 372/****************************** DECLARATIONS ********************************/
@@ -387,6 +401,40 @@ void
387mesh_peer_disconnect_handler (void *cls, 401mesh_peer_disconnect_handler (void *cls,
388 const struct GNUNET_PeerIdentity * peer_id); 402 const struct GNUNET_PeerIdentity * peer_id);
389 403
404/**
405 * Mesh connect callback.
406 *
407 * @param cls internal peer id.
408 * @param op operation handle.
409 * @param ca_result connect adapter result.
410 * @param emsg error message.
411 */
412void
413mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
414 void *ca_result, const char *emsg);
415
416/**
417 * Mesh connect adapter.
418 *
419 * @param cls not used.
420 * @param cfg configuration handle.
421 *
422 * @return
423 */
424void *
425mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg);
426
427
428/**
429 * Adapter function called to destroy a connection to
430 * the mesh service
431 *
432 * @param cls closure
433 * @param op_result service handle returned from the connect adapter
434 */
435void
436mesh_da (void *cls, void *op_result);
437
390 438
391/******************************************************************************/ 439/******************************************************************************/
392/******************************** SHUTDOWN **********************************/ 440/******************************** SHUTDOWN **********************************/
@@ -587,19 +635,23 @@ stats_connect_cb (void *cls,
587{ 635{
588 struct RegexPeer *peer = cls; 636 struct RegexPeer *peer = cls;
589 637
590 if (NULL == ca_result) 638 if (NULL == ca_result || NULL != emsg)
591 { 639 {
592 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 640 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
593 "Failed to connect to statistics service on peer %u: %s\n", 641 "Failed to connect to statistics service on peer %u: %s\n",
594 peer->id, emsg); 642 peer->id, emsg);
643
644 peer->stats_handle = NULL;
595 return; 645 return;
596 } 646 }
597 647
648 GNUNET_assert (NULL != peer->mesh_handle);
649
598 peer->stats_handle = ca_result; 650 peer->stats_handle = ca_result;
599 651
600 peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle, 652 peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle,
601 NULL, 653 NULL,
602 &mesh_peer_connect_handler, 654 &mesh_peer_connect_handler,
603 &mesh_peer_disconnect_handler, 655 &mesh_peer_disconnect_handler,
604 peer); 656 peer);
605 657
@@ -711,6 +763,11 @@ mesh_peer_connect_handler (void *cls,
711 peer->search_str, peer->id, GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), 763 peer->search_str, peer->id, GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO),
712 peers_found, num_search_strings); 764 peers_found, num_search_strings);
713 765
766 printf ("String %s successfully matched on peer %u after %s (%i/%i)\n",
767 peer->search_str, peer->id, GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO),
768 peers_found, num_search_strings);
769 fflush (stdout);
770
714 if (NULL != data_file) 771 if (NULL != data_file)
715 { 772 {
716 size = 773 size =
@@ -728,6 +785,13 @@ mesh_peer_connect_handler (void *cls,
728 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); 785 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
729 } 786 }
730 787
788 if (NULL == peer->stats_handle)
789 {
790 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
791 "Cannot get statistics for peer %u, stats handle is NULL!\n");
792 return;
793 }
794
731 if (NULL == GNUNET_STATISTICS_get (peer->stats_handle, "mesh", NULL, 795 if (NULL == GNUNET_STATISTICS_get (peer->stats_handle, "mesh", NULL,
732 GNUNET_TIME_UNIT_FOREVER_REL, 796 GNUNET_TIME_UNIT_FOREVER_REL,
733 NULL, 797 NULL,
@@ -802,6 +866,9 @@ do_connect_by_string (void *cls,
802 unsigned int search_cnt; 866 unsigned int search_cnt;
803 struct RegexPeer *peer; 867 struct RegexPeer *peer;
804 868
869 printf ("Starting string search.\n");
870 fflush (stdout);
871
805 for (search_cnt = 0; search_cnt < num_search_strings; search_cnt++) 872 for (search_cnt = 0; search_cnt < num_search_strings; search_cnt++)
806 { 873 {
807 peer = &peers[search_cnt % num_peers]; 874 peer = &peers[search_cnt % num_peers];
@@ -811,15 +878,16 @@ do_connect_by_string (void *cls,
811 "Searching for string \"%s\" on peer %d with file %s\n", 878 "Searching for string \"%s\" on peer %d with file %s\n",
812 peer->search_str, (search_cnt % num_peers), peer->policy_file); 879 peer->search_str, (search_cnt % num_peers), peer->policy_file);
813 880
814 /* First connect to stats service, then try connecting by string in stats_connect_cb */ 881 /* First connect to mesh service, then connect to stats service
815 peer->stats_op_handle = 882 and then try connecting by string in stats_connect_cb */
883 peer->mesh_op_handle =
816 GNUNET_TESTBED_service_connect (NULL, 884 GNUNET_TESTBED_service_connect (NULL,
817 peers->peer_handle, 885 peers->peer_handle,
818 "statistics", 886 "mesh",
819 &stats_connect_cb, 887 &mesh_connect_cb,
820 peer, 888 peer,
821 &stats_ca, 889 &mesh_ca,
822 &stats_da, 890 &mesh_da,
823 peer); 891 peer);
824 } 892 }
825 893
@@ -829,95 +897,18 @@ do_connect_by_string (void *cls,
829 897
830 898
831/** 899/**
832 * Announce regex task that announces the regexes stored in the peers policy file. 900 * Delayed operation done for mesh service disconnects.
833 * 901 *
834 * @param cls NULL 902 * @param cls NULL
835 * @param tc the task context 903 * @param tc the task context
836 */ 904 */
837static void 905static void
838do_announce_regexes (void *cls, 906do_mesh_op_done (void *cls,
839 const struct GNUNET_SCHEDULER_TaskContext * tc) 907 const struct GNUNET_SCHEDULER_TaskContext * tc)
840{ 908{
841 static unsigned int num_announced_files; 909 struct RegexPeer *peer = cls;
842 struct RegexPeer *peer; 910 GNUNET_TESTBED_operation_done (peer->mesh_op_handle);
843 char *regex; 911 peer->mesh_op_handle = NULL;
844 char *data;
845 char *buf;
846 uint64_t filesize;
847 unsigned int offset;
848 unsigned int limit;
849
850 limit = num_announced_files + announce_batch_size;
851
852 for (; num_announced_files < limit
853 && num_announced_files < num_peers; num_announced_files++)
854 {
855 peer = &peers[num_announced_files];
856
857 GNUNET_assert (NULL != peer->policy_file);
858
859 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
860 "Announcing regexes for peer %u with file %s\n",
861 peer->id, peer->policy_file);
862
863 if (GNUNET_YES != GNUNET_DISK_file_test (peer->policy_file))
864 {
865 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
866 "Could not find policy file %s\n", peer->policy_file);
867 return;
868 }
869 if (GNUNET_OK != GNUNET_DISK_file_size (peer->policy_file, &filesize, GNUNET_YES, GNUNET_YES))
870 filesize = 0;
871 if (0 == filesize)
872 {
873 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Policy file %s is empty.\n", peer->policy_file);
874 return;
875 }
876 data = GNUNET_malloc (filesize);
877 if (filesize != GNUNET_DISK_fn_read (peer->policy_file, data, filesize))
878 {
879 GNUNET_free (data);
880 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not read policy file %s.\n",
881 peer->policy_file);
882 return;
883 }
884 buf = data;
885 offset = 0;
886 regex = NULL;
887 while (offset < (filesize - 1))
888 {
889 offset++;
890 if (((data[offset] == '\n')) && (buf != &data[offset]))
891 {
892 data[offset] = '\0';
893 regex = buf;
894 GNUNET_assert (NULL != regex);
895 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s on peer %u \n",
896 regex, peer->id);
897 GNUNET_MESH_announce_regex (peer->mesh_handle, regex, max_path_compression);
898 buf = &data[offset + 1];
899 }
900 else if ((data[offset] == '\n') || (data[offset] == '\0'))
901 buf = &data[offset + 1];
902 }
903 GNUNET_free (data);
904 }
905
906 if (num_announced_files < num_peers)
907 GNUNET_SCHEDULER_add_delayed (announce_delay, &do_announce_regexes, NULL);
908 else
909 {
910 printf ("All regexes announced. Waiting %s before starting to search.\n",
911 GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES));
912 fflush (stdout);
913
914 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
915 "All mesh handles connected. Waiting %s before starting to search.\n",
916 GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES));
917
918 search_task = GNUNET_SCHEDULER_add_delayed (search_delay,
919 &do_connect_by_string, NULL);
920 }
921} 912}
922 913
923 914
@@ -933,23 +924,130 @@ void
933mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, 924mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
934 void *ca_result, const char *emsg) 925 void *ca_result, const char *emsg)
935{ 926{
936 static unsigned int connected_mesh_handles; 927 static unsigned int peer_cnt;
937 struct RegexPeer *peer = (struct RegexPeer *) cls; 928 struct RegexPeer *peer = (struct RegexPeer *) cls;
929 char *regex;
930 char *data;
931 char *buf;
932 uint64_t filesize;
933 unsigned int offset;
938 934
939 if (NULL != emsg) 935 if (NULL != emsg || NULL == op || NULL == ca_result)
940 { 936 {
941 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Mesh connect failed: %s\n", emsg); 937 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Mesh connect failed: %s\n", emsg);
942 GNUNET_assert (0); 938 GNUNET_assert (0);
943 } 939 }
944 940
941 GNUNET_assert (peer->mesh_handle != NULL);
945 GNUNET_assert (peer->mesh_op_handle == op); 942 GNUNET_assert (peer->mesh_op_handle == op);
946 GNUNET_assert (peer->mesh_handle == ca_result); 943 GNUNET_assert (peer->mesh_handle == ca_result);
944 GNUNET_assert (NULL != peer->policy_file);
947 945
948 if (++connected_mesh_handles == num_peers) 946 switch (state)
949 { 947 {
950 printf ("\nStarting to announce regexes.\n"); 948 case STATE_ANNOUNCE_REGEX:
951 fflush (stdout); 949 {
952 GNUNET_SCHEDULER_add_now (&do_announce_regexes, NULL); 950 static unsigned int num_files_announced;
951
952 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
953 "Announcing regexes for peer %u with file %s\n",
954 peer->id, peer->policy_file);
955
956 if (GNUNET_YES != GNUNET_DISK_file_test (peer->policy_file))
957 {
958 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
959 "Could not find policy file %s\n", peer->policy_file);
960 return;
961 }
962 if (GNUNET_OK != GNUNET_DISK_file_size (peer->policy_file, &filesize, GNUNET_YES, GNUNET_YES))
963 filesize = 0;
964 if (0 == filesize)
965 {
966 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Policy file %s is empty.\n", peer->policy_file);
967 return;
968 }
969 data = GNUNET_malloc (filesize);
970 if (filesize != GNUNET_DISK_fn_read (peer->policy_file, data, filesize))
971 {
972 GNUNET_free (data);
973 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not read policy file %s.\n",
974 peer->policy_file);
975 return;
976 }
977 buf = data;
978 offset = 0;
979 regex = NULL;
980 while (offset < (filesize - 1))
981 {
982 offset++;
983 if (((data[offset] == '\n')) && (buf != &data[offset]))
984 {
985 data[offset] = '\0';
986 regex = buf;
987 GNUNET_assert (NULL != regex);
988 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s on peer %u \n",
989 regex, peer->id);
990 GNUNET_MESH_announce_regex (peer->mesh_handle, regex, max_path_compression);
991 buf = &data[offset + 1];
992 }
993 else if ((data[offset] == '\n') || (data[offset] == '\0'))
994 buf = &data[offset + 1];
995 }
996 GNUNET_free (data);
997
998 GNUNET_SCHEDULER_add_delayed (mesh_done_delay, &do_mesh_op_done, peer);
999
1000 if (++peer_cnt < num_peers)
1001 {
1002 peers[peer_cnt].mesh_op_handle =
1003 GNUNET_TESTBED_service_connect (NULL,
1004 peers[peer_cnt].peer_handle,
1005 "mesh",
1006 &mesh_connect_cb,
1007 &peers[peer_cnt],
1008 &mesh_ca,
1009 &mesh_da,
1010 &peers[peer_cnt]);
1011 }
1012
1013 if (++num_files_announced == num_peers)
1014 {
1015 state = STATE_SEARCH_REGEX;
1016
1017 prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
1018
1019 printf ("All files announced in %s.\n",
1020 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO));
1021 printf ("Waiting %s before starting to search.\n",
1022 GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES));
1023 fflush (stdout);
1024
1025 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1026 "All regexes announced in %s. Waiting %s before starting to search.\n",
1027 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO),
1028 GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_NO));
1029
1030 search_task = GNUNET_SCHEDULER_add_delayed (search_delay,
1031 &do_connect_by_string, NULL);
1032 }
1033 break;
1034 }
1035 case STATE_SEARCH_REGEX:
1036 {
1037 /* First connect to the stats service, then start to search */
1038 peer->stats_op_handle =
1039 GNUNET_TESTBED_service_connect (NULL,
1040 peers->peer_handle,
1041 "statistics",
1042 &stats_connect_cb,
1043 peer,
1044 &stats_ca,
1045 &stats_da,
1046 peer);
1047 break;
1048 }
1049 default:
1050 GNUNET_break (0);
953 } 1051 }
954} 1052}
955 1053
@@ -1055,18 +1153,18 @@ peer_churn_cb (void *cls, const char *emsg)
1055 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) 1153 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
1056 peer_handles[peer_cnt] = peers[peer_cnt].peer_handle; 1154 peer_handles[peer_cnt] = peers[peer_cnt].peer_handle;
1057 1155
1156 /*
1058 if (0 == linking_factor) 1157 if (0 == linking_factor)
1059 linking_factor = 1; 1158 linking_factor = 1;
1060 num_links = linking_factor * num_peers; 1159 num_links = linking_factor * num_peers;
1061 1160 */
1161 num_links = num_peers - 1;
1062 state = STATE_PEERS_LINKING; 1162 state = STATE_PEERS_LINKING;
1063 /* Do overlay connect */ 1163 /* Do overlay connect */
1064 prof_start_time = GNUNET_TIME_absolute_get (); 1164 prof_start_time = GNUNET_TIME_absolute_get ();
1065 topology_op = 1165 topology_op =
1066 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, 1166 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles,
1067 GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, 1167 GNUNET_TESTBED_TOPOLOGY_LINE,
1068 num_links,
1069 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
1070 GNUNET_TESTBED_TOPOLOGY_OPTION_END); 1168 GNUNET_TESTBED_TOPOLOGY_OPTION_END);
1071 if (NULL == topology_op) 1169 if (NULL == topology_op)
1072 { 1170 {
@@ -1258,93 +1356,103 @@ controller_event_cb (void *cls,
1258 break; 1356 break;
1259 case STATE_PEERS_LINKING: 1357 case STATE_PEERS_LINKING:
1260 switch (event->type) 1358 switch (event->type)
1261 { 1359 {
1262 static unsigned int established_links; 1360 static unsigned int established_links;
1263 case GNUNET_TESTBED_ET_OPERATION_FINISHED: 1361 case GNUNET_TESTBED_ET_OPERATION_FINISHED:
1264 /* Control reaches here when a peer linking operation fails */ 1362 /* Control reaches here when a peer linking operation fails */
1265 if (NULL != event->details.operation_finished.emsg) 1363 if (NULL != event->details.operation_finished.emsg)
1266 { 1364 {
1267 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1365 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1268 _("An operation has failed while linking\n")); 1366 _("An operation has failed while linking\n"));
1269 printf ("F"); 1367 printf ("F");
1270 fflush (stdout); 1368 fflush (stdout);
1271 retry_links++; 1369 retry_links++;
1272 1370
1273 if (++cont_fails > num_cont_fails) 1371 if (++cont_fails > num_cont_fails)
1274 { 1372 {
1275 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1373 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1276 "We have a very high peer linking failure rate: %u (threshold: %u)\n", 1374 "We have a very high peer linking failure rate: %u (threshold: %u)\n",
1277 cont_fails, 1375 cont_fails,
1278 num_cont_fails); 1376 num_cont_fails);
1279 } 1377 }
1280 } 1378 }
1281 /* We do no retries, consider this link as established */ 1379 /* We do no retries, consider this link as established */
1282 /* break; */ 1380 break;
1283 case GNUNET_TESTBED_ET_CONNECT: 1381 case GNUNET_TESTBED_ET_CONNECT:
1284 { 1382 {
1285 unsigned int peer_cnt; 1383 char output_buffer[512];
1286 char output_buffer[512]; 1384 size_t size;
1287 size_t size; 1385
1288 1386 if (0 == established_links)
1289 if (0 == established_links) 1387 printf ("Establishing links .");
1290 printf ("Establishing links ."); 1388 else
1291 else 1389 {
1292 { 1390 printf (".");
1293 printf ("."); 1391 fflush (stdout);
1294 fflush (stdout); 1392 }
1295 } 1393 if (++established_links == num_links)
1296 if (++established_links == num_links) 1394 {
1297 { 1395 fflush (stdout);
1298 fflush (stdout); 1396 prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
1299 prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); 1397 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1300 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1398 "%u links established in %s\n",
1301 "%u links established in %s\n", 1399 num_links,
1302 num_links, 1400 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO));
1303 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); 1401 result = GNUNET_OK;
1304 result = GNUNET_OK; 1402 GNUNET_free (peer_handles);
1305 GNUNET_free (peer_handles); 1403
1306 1404 if (NULL != data_file)
1307 if (NULL != data_file) 1405 {
1308 { 1406 size =
1309 size = 1407 GNUNET_snprintf (output_buffer,
1310 GNUNET_snprintf (output_buffer, 1408 sizeof (output_buffer),
1311 sizeof (output_buffer), 1409 "# of peers: %u\n# of links established: %u\n"
1312 "# of peers: %u\n# of links established: %u\n" 1410 "Time to establish links: %s\nLinking failures: %u\n"
1313 "Time to establish links: %s\nLinking failures: %u\n" 1411 "path compression length: %u\n",
1314 "path compression length: %u\n", 1412 num_peers,
1315 num_peers, 1413 (established_links - cont_fails),
1316 (established_links - cont_fails), 1414 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO),
1317 GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), 1415 cont_fails,
1318 cont_fails, 1416 max_path_compression);
1319 max_path_compression); 1417
1320 1418 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size))
1321 if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) 1419 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n");
1322 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); 1420 }
1323 } 1421
1324 1422 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1325 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1423 "Connecting to mesh service and start announcing regex...\n");
1326 "Connecting to mesh and statistics service...\n"); 1424 printf ("\nStarting to connect to mesh services and announce regex\n");
1327 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) 1425 fflush (stdout);
1328 { 1426
1329 peers[peer_cnt].mesh_op_handle = 1427 prof_start_time = GNUNET_TIME_absolute_get ();
1330 GNUNET_TESTBED_service_connect (NULL, 1428 peers[0].mesh_op_handle =
1331 peers[peer_cnt].peer_handle, 1429 GNUNET_TESTBED_service_connect (NULL,
1332 "mesh", 1430 peers[0].peer_handle,
1333 &mesh_connect_cb, 1431 "mesh",
1334 &peers[peer_cnt], 1432 &mesh_connect_cb,
1335 &mesh_ca, 1433 &peers[0],
1336 &mesh_da, 1434 &mesh_ca,
1337 &peers[peer_cnt]); 1435 &mesh_da,
1338 } 1436 &peers[0]);
1339 } 1437 state = STATE_ANNOUNCE_REGEX;
1340 } 1438 }
1341 break; 1439 }
1342 default: 1440 break;
1343 GNUNET_assert (0); 1441 default:
1344 } 1442 GNUNET_assert (0);
1443 }
1444 break;
1445 case STATE_ANNOUNCE_REGEX:
1446 {
1447 /* Handled in service connect callback */
1345 break; 1448 break;
1449 }
1450 case STATE_SEARCH_REGEX:
1451 {
1452 /* Handled in service connect callback */
1453 break;
1454 }
1346 default: 1455 default:
1347
1348 switch (state) 1456 switch (state)
1349 { 1457 {
1350 case STATE_PEERS_CREATING: 1458 case STATE_PEERS_CREATING: