aboutsummaryrefslogtreecommitdiff
path: root/src/arm/test_arm_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-05 09:56:25 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-05 09:56:25 +0000
commitd75fb1880a887a8f5339c5e8cf5e9d2b8755fdad (patch)
treef8dff53b4b88b0d87ca31a772607ee51fb0653ec /src/arm/test_arm_api.c
parentb9b0940e261a4b1713d909f0a2fd54134ed5b148 (diff)
downloadgnunet-d75fb1880a887a8f5339c5e8cf5e9d2b8755fdad.tar.gz
gnunet-d75fb1880a887a8f5339c5e8cf5e9d2b8755fdad.zip
improving ARM API
Diffstat (limited to 'src/arm/test_arm_api.c')
-rw-r--r--src/arm/test_arm_api.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/arm/test_arm_api.c b/src/arm/test_arm_api.c
index fbd90583e..22fa3716e 100644
--- a/src/arm/test_arm_api.c
+++ b/src/arm/test_arm_api.c
@@ -40,17 +40,28 @@ static struct GNUNET_SCHEDULER_Handle *sched;
40 40
41static const struct GNUNET_CONFIGURATION_Handle *cfg; 41static const struct GNUNET_CONFIGURATION_Handle *cfg;
42 42
43static struct GNUNET_ARM_Handle *arm;
44
43static int ok = 1; 45static int ok = 1;
44 46
47
48static void
49arm_notify_stop (void *cls, int success)
50{
51 GNUNET_assert (success == GNUNET_NO);
52#if START_ARM
53 GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, NULL, NULL);
54#endif
55}
56
57
45static void 58static void
46dns_notify (void *cls, const struct sockaddr *addr, socklen_t addrlen) 59dns_notify (void *cls, const struct sockaddr *addr, socklen_t addrlen)
47{ 60{
48 if (addr == NULL) 61 if (addr == NULL)
49 { 62 {
50 GNUNET_assert (ok == 0); 63 GNUNET_assert (ok == 0);
51#if START_ARM 64 GNUNET_ARM_stop_service (arm, "resolver", TIMEOUT, &arm_notify_stop, NULL);
52 GNUNET_ARM_stop_service ("arm", cfg, sched, TIMEOUT, NULL, NULL);
53#endif
54 return; 65 return;
55 } 66 }
56 GNUNET_assert (addr != NULL); 67 GNUNET_assert (addr != NULL);
@@ -62,21 +73,17 @@ static void
62resolver_notify (void *cls, int success) 73resolver_notify (void *cls, int success)
63{ 74{
64 GNUNET_assert (success == GNUNET_YES); 75 GNUNET_assert (success == GNUNET_YES);
65 sleep (1); /* FIXME: that we need to do this is a problem... */
66 GNUNET_RESOLVER_ip_get (sched, 76 GNUNET_RESOLVER_ip_get (sched,
67 cfg, 77 cfg,
68 "localhost", AF_INET, TIMEOUT, &dns_notify, NULL); 78 "localhost", AF_INET, TIMEOUT, &dns_notify, NULL);
69} 79}
70 80
81
71static void 82static void
72arm_notify (void *cls, int success) 83arm_notify (void *cls, int success)
73{ 84{
74 GNUNET_assert (success == GNUNET_YES); 85 GNUNET_assert (success == GNUNET_YES);
75#if START_ARM 86 GNUNET_ARM_start_service (arm, "resolver", TIMEOUT, &resolver_notify, NULL);
76 sleep (1); /* FIXME: that we need to do this is a problem... */
77#endif
78 GNUNET_ARM_start_service ("resolver",
79 cfg, sched, TIMEOUT, &resolver_notify, NULL);
80} 87}
81 88
82 89
@@ -89,8 +96,9 @@ task (void *cls,
89{ 96{
90 cfg = c; 97 cfg = c;
91 sched = s; 98 sched = s;
99 arm = GNUNET_ARM_connect (cfg, sched, NULL);
92#if START_ARM 100#if START_ARM
93 GNUNET_ARM_start_service ("arm", cfg, sched, TIMEOUT, &arm_notify, NULL); 101 GNUNET_ARM_start_service (arm, "arm", TIMEOUT, &arm_notify, NULL);
94#else 102#else
95 arm_notify (NULL, GNUNET_YES); 103 arm_notify (NULL, GNUNET_YES);
96#endif 104#endif