aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-10-19 10:15:24 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-10-19 10:15:24 +0000
commit6cbb37990ee05f177500b64e9db02352e03868be (patch)
treea39c5a76e3130c468fbfaff3381c5435b41abb49 /src
parent44bab2e9f9f2d9117ed0c3bd542804472c2d70b8 (diff)
downloadgnunet-6cbb37990ee05f177500b64e9db02352e03868be.tar.gz
gnunet-6cbb37990ee05f177500b64e9db02352e03868be.zip
mesh connections in regex profiler
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-regex-profiler.c29
-rw-r--r--src/mesh/regex_profiler_test.conf2
2 files changed, 26 insertions, 5 deletions
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c
index b2634c2b8..e18c5643b 100644
--- a/src/mesh/gnunet-regex-profiler.c
+++ b/src/mesh/gnunet-regex-profiler.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file regex/gnunet-regex-profiler.c 22 * @file mesh/gnunet-regex-profiler.c
23 * @brief Regex profiler for testing distributed regex use. 23 * @brief Regex profiler for testing distributed regex use.
24 * @author Bart Polot 24 * @author Bart Polot
25 * @author Max Szengel 25 * @author Max Szengel
@@ -347,7 +347,9 @@ void
347mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, 347mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
348 void *ca_result, const char *emsg) 348 void *ca_result, const char *emsg)
349{ 349{
350 static unsigned int connected_mesh_handles;
350 struct Peer *peer = (struct Peer *) cls; 351 struct Peer *peer = (struct Peer *) cls;
352 unsigned int peer_cnt;
351 353
352 if (NULL != emsg) 354 if (NULL != emsg)
353 { 355 {
@@ -358,11 +360,22 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
358 GNUNET_assert (peer->op_handle == op); 360 GNUNET_assert (peer->op_handle == op);
359 GNUNET_assert (peer->mesh_handle == ca_result); 361 GNUNET_assert (peer->mesh_handle == ca_result);
360 362
361 GNUNET_TESTBED_operation_done (op); 363 // GNUNET_TESTBED_operation_done (op);
362 364
363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh connect callback for peer\n"); 365 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh connect callback for peer\n");
364 366
365 //GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 367 if (++connected_mesh_handles == num_peers)
368 {
369 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All mesh handles connected\n");
370
371 // TODO announce regexes...
372
373 for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
374 {
375 GNUNET_TESTBED_operation_done (peers[peer_cnt].op_handle);
376 }
377 }
378
366} 379}
367 380
368 381
@@ -377,7 +390,6 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
377void * 390void *
378mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) 391mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
379{ 392{
380
381 struct Peer *peer = (struct Peer *) cls; 393 struct Peer *peer = (struct Peer *) cls;
382 394
383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh connect adapter\n"); 395 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh connect adapter\n");
@@ -408,11 +420,20 @@ mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
408void 420void
409mesh_da (void *cls, void *op_result) 421mesh_da (void *cls, void *op_result)
410{ 422{
423 static unsigned int disconnected_mesh_handles;
411 struct Peer *peer = (struct Peer *) cls; 424 struct Peer *peer = (struct Peer *) cls;
412 425
413 GNUNET_assert (peer->mesh_handle == op_result); 426 GNUNET_assert (peer->mesh_handle == op_result);
414 427
415 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh disconnect adapter\n"); 428 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh disconnect adapter\n");
429
430 GNUNET_MESH_disconnect (peer->mesh_handle);
431 peer->mesh_handle = NULL;
432
433 if (++disconnected_mesh_handles == num_peers)
434 {
435 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
436 }
416} 437}
417 438
418 439
diff --git a/src/mesh/regex_profiler_test.conf b/src/mesh/regex_profiler_test.conf
index 0f3dbcc47..1c59eff6d 100644
--- a/src/mesh/regex_profiler_test.conf
+++ b/src/mesh/regex_profiler_test.conf
@@ -14,7 +14,7 @@ AUTOSTART = NO
14AUTOSTART = NO 14AUTOSTART = NO
15 15
16[mesh] 16[mesh]
17AUTOSTART = YES 17AUTOSTART = NO
18 18
19[dht] 19[dht]
20AUTOSTART = NO 20AUTOSTART = NO