aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/test_mesh_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-05-12 14:01:29 +0000
committerChristian Grothoff <christian@grothoff.org>2011-05-12 14:01:29 +0000
commitd75e6e4273b1bb43b5ca9f6b207c10fc824efbae (patch)
tree4b2548eabb82b8a00df676558125640fe72eac3c /src/mesh/test_mesh_api.c
parentd95d14541ab481ad4697a432b5598535af07804c (diff)
downloadgnunet-d75e6e4273b1bb43b5ca9f6b207c10fc824efbae.tar.gz
gnunet-d75e6e4273b1bb43b5ca9f6b207c10fc824efbae.zip
fixes
Diffstat (limited to 'src/mesh/test_mesh_api.c')
-rw-r--r--src/mesh/test_mesh_api.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/mesh/test_mesh_api.c b/src/mesh/test_mesh_api.c
index 00212eb49..5f988f555 100644
--- a/src/mesh/test_mesh_api.c
+++ b/src/mesh/test_mesh_api.c
@@ -7,16 +7,31 @@ static struct GNUNET_MESH_MessageHandler handlers[] = {
7 {NULL, 0, 0} 7 {NULL, 0, 0}
8}; 8};
9 9
10static struct GNUNET_OS_Process *arm_pid;
11
12static struct GNUNET_MESH_Handle *mesh;
13
14static struct GNUNET_DHT_Handle *dht;
15
16static void
17 do_shutdown (void *cls,
18 const struct GNUNET_SCHEDULER_TaskContext *tc)
19{
20 if (NULL != mesh)
21 GNUNET_MESH_disconnect (mesh);
22 if (0 != GNUNET_OS_process_kill (arm_pid, SIGTERM))
23 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
24 GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (arm_pid));
25 GNUNET_OS_process_close (arm_pid);
26}
27
10 28
11static void 29static void
12run (void *cls, 30run (void *cls,
13 char *const *args, 31 char *const *args,
14 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { 32 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) {
15 struct GNUNET_OS_Process *arm_pid;
16 struct GNUNET_MESH_Handle *mesh;
17 struct GNUNET_DHT_Handle *dht;
18 GNUNET_MESH_ApplicationType app; 33 GNUNET_MESH_ApplicationType app;
19 char buffer[2048]; 34 // char buffer[2048];
20 35
21 36
22 arm_pid = GNUNET_OS_start_process (NULL, NULL, 37 arm_pid = GNUNET_OS_start_process (NULL, NULL,
@@ -41,16 +56,15 @@ run (void *cls,
41 } 56 }
42 57
43 /* do real test work here */ 58 /* do real test work here */
44 if (0 != GNUNET_OS_process_kill (arm_pid, SIGTERM)) 59 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
45 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 60 &do_shutdown,
46 GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (arm_pid)); 61 NULL);
47 GNUNET_OS_process_close (arm_pid);
48
49 return;
50} 62}
51 63
52 64
53 65
66
67
54int main (int argc, char *argv[]) { 68int main (int argc, char *argv[]) {
55 int ret; 69 int ret;
56 char *const argv2[] = {"test-mesh-api", 70 char *const argv2[] = {"test-mesh-api",