diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-10-19 10:15:24 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-10-19 10:15:24 +0000 |
commit | 6cbb37990ee05f177500b64e9db02352e03868be (patch) | |
tree | a39c5a76e3130c468fbfaff3381c5435b41abb49 /src | |
parent | 44bab2e9f9f2d9117ed0c3bd542804472c2d70b8 (diff) | |
download | gnunet-6cbb37990ee05f177500b64e9db02352e03868be.tar.gz gnunet-6cbb37990ee05f177500b64e9db02352e03868be.zip |
mesh connections in regex profiler
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-regex-profiler.c | 29 | ||||
-rw-r--r-- | src/mesh/regex_profiler_test.conf | 2 |
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 | |||
347 | mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | 347 | mesh_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, | |||
377 | void * | 390 | void * |
378 | mesh_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) | 391 | mesh_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) | |||
408 | void | 420 | void |
409 | mesh_da (void *cls, void *op_result) | 421 | mesh_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 | |||
14 | AUTOSTART = NO | 14 | AUTOSTART = NO |
15 | 15 | ||
16 | [mesh] | 16 | [mesh] |
17 | AUTOSTART = YES | 17 | AUTOSTART = NO |
18 | 18 | ||
19 | [dht] | 19 | [dht] |
20 | AUTOSTART = NO | 20 | AUTOSTART = NO |