diff options
Diffstat (limited to 'src/core/test_core_api_reliability.c')
-rw-r--r-- | src/core/test_core_api_reliability.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index dd70d438a..38c40da12 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c | |||
@@ -33,8 +33,6 @@ | |||
33 | #include "gnunet_transport_service.h" | 33 | #include "gnunet_transport_service.h" |
34 | #include <gauger.h> | 34 | #include <gauger.h> |
35 | 35 | ||
36 | #define START_ARM GNUNET_YES | ||
37 | |||
38 | /** | 36 | /** |
39 | * Note that this value must not significantly exceed | 37 | * Note that this value must not significantly exceed |
40 | * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise | 38 | * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise |
@@ -73,9 +71,7 @@ struct PeerContext | |||
73 | struct GNUNET_MessageHeader *hello; | 71 | struct GNUNET_MessageHeader *hello; |
74 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | 72 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; |
75 | int connect_status; | 73 | int connect_status; |
76 | #if START_ARM | ||
77 | struct GNUNET_OS_Process *arm_proc; | 74 | struct GNUNET_OS_Process *arm_proc; |
78 | #endif | ||
79 | }; | 75 | }; |
80 | 76 | ||
81 | static struct PeerContext p1; | 77 | static struct PeerContext p1; |
@@ -121,8 +117,10 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
121 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); | 117 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
122 | GNUNET_CORE_disconnect (p1.ch); | 118 | GNUNET_CORE_disconnect (p1.ch); |
123 | p1.ch = NULL; | 119 | p1.ch = NULL; |
120 | GNUNET_free_non_null (p1.hello); | ||
124 | GNUNET_CORE_disconnect (p2.ch); | 121 | GNUNET_CORE_disconnect (p2.ch); |
125 | p2.ch = NULL; | 122 | p2.ch = NULL; |
123 | GNUNET_free_non_null (p2.hello); | ||
126 | if (connect_task != GNUNET_SCHEDULER_NO_TASK) | 124 | if (connect_task != GNUNET_SCHEDULER_NO_TASK) |
127 | GNUNET_SCHEDULER_cancel (connect_task); | 125 | GNUNET_SCHEDULER_cancel (connect_task); |
128 | GNUNET_TRANSPORT_disconnect (p1.th); | 126 | GNUNET_TRANSPORT_disconnect (p1.th); |
@@ -409,8 +407,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
409 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 407 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
410 | "Received (my) `%s' from transport service\n", "HELLO"); | 408 | "Received (my) `%s' from transport service\n", "HELLO"); |
411 | GNUNET_assert (message != NULL); | 409 | GNUNET_assert (message != NULL); |
412 | p->hello = GNUNET_malloc (ntohs (message->size)); | 410 | p->hello = GNUNET_copy_message (message); |
413 | memcpy (p->hello, message, ntohs (message->size)); | ||
414 | if ((p == &p1) && (p2.th != NULL)) | 411 | if ((p == &p1) && (p2.th != NULL)) |
415 | GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL); | 412 | GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL); |
416 | if ((p == &p2) && (p1.th != NULL)) | 413 | if ((p == &p2) && (p1.th != NULL)) |
@@ -430,12 +427,10 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
430 | 427 | ||
431 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); | 428 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); |
432 | p->cfg = GNUNET_CONFIGURATION_create (); | 429 | p->cfg = GNUNET_CONFIGURATION_create (); |
433 | #if START_ARM | ||
434 | p->arm_proc = | 430 | p->arm_proc = |
435 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary, | 431 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary, |
436 | "gnunet-service-arm", | 432 | "gnunet-service-arm", |
437 | "-c", cfgname, NULL); | 433 | "-c", cfgname, NULL); |
438 | #endif | ||
439 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 434 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
440 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); | 435 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); |
441 | GNUNET_assert (p->th != NULL); | 436 | GNUNET_assert (p->th != NULL); |
@@ -463,7 +458,6 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
463 | static void | 458 | static void |
464 | stop_arm (struct PeerContext *p) | 459 | stop_arm (struct PeerContext *p) |
465 | { | 460 | { |
466 | #if START_ARM | ||
467 | if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) | 461 | if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) |
468 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 462 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
469 | if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) | 463 | if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) |
@@ -472,7 +466,6 @@ stop_arm (struct PeerContext *p) | |||
472 | GNUNET_OS_process_get_pid (p->arm_proc)); | 466 | GNUNET_OS_process_get_pid (p->arm_proc)); |
473 | GNUNET_OS_process_destroy (p->arm_proc); | 467 | GNUNET_OS_process_destroy (p->arm_proc); |
474 | p->arm_proc = NULL; | 468 | p->arm_proc = NULL; |
475 | #endif | ||
476 | GNUNET_CONFIGURATION_destroy (p->cfg); | 469 | GNUNET_CONFIGURATION_destroy (p->cfg); |
477 | } | 470 | } |
478 | 471 | ||