diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-05-06 09:54:08 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-05-06 09:54:08 +0000 |
commit | 1948cedcb5e7c5017dcd18ef087f0f7e5aa5f27f (patch) | |
tree | 53048b78f1bec588db3c7f7d72a35e483ccf2795 /src/arm/test_arm_api.c | |
parent | 031972ecd7ef2a767cbe8caf3c6fb649567a6b0d (diff) | |
download | gnunet-1948cedcb5e7c5017dcd18ef087f0f7e5aa5f27f.tar.gz gnunet-1948cedcb5e7c5017dcd18ef087f0f7e5aa5f27f.zip |
main change for gnunet-arm is that gnunet-arm now gets proper confirmation when called to start or stop services. This means that calling gnunet-arm to stop/start a process will return 0 only if the process is stopped/started. For gnunet-service-arm, this is implemented by leaking the client connection socket on a shutdown request, so that it is only closed when the arm service actually shuts down (indicating everything is really down).
Diffstat (limited to 'src/arm/test_arm_api.c')
-rw-r--r-- | src/arm/test_arm_api.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/arm/test_arm_api.c b/src/arm/test_arm_api.c index 22fa3716e..7fab89ca7 100644 --- a/src/arm/test_arm_api.c +++ b/src/arm/test_arm_api.c | |||
@@ -34,7 +34,9 @@ | |||
34 | 34 | ||
35 | #define START_ARM GNUNET_YES | 35 | #define START_ARM GNUNET_YES |
36 | 36 | ||
37 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | 37 | #define START_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 50) |
38 | |||
39 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) | ||
38 | 40 | ||
39 | static struct GNUNET_SCHEDULER_Handle *sched; | 41 | static struct GNUNET_SCHEDULER_Handle *sched; |
40 | 42 | ||
@@ -44,13 +46,21 @@ static struct GNUNET_ARM_Handle *arm; | |||
44 | 46 | ||
45 | static int ok = 1; | 47 | static int ok = 1; |
46 | 48 | ||
49 | static void | ||
50 | arm_stopped (void *cls, int success) | ||
51 | { | ||
52 | if (success != GNUNET_NO) | ||
53 | ok = 1; | ||
54 | else | ||
55 | ok = 0; | ||
56 | } | ||
47 | 57 | ||
48 | static void | 58 | static void |
49 | arm_notify_stop (void *cls, int success) | 59 | arm_notify_stop (void *cls, int success) |
50 | { | 60 | { |
51 | GNUNET_assert (success == GNUNET_NO); | 61 | GNUNET_assert (success == GNUNET_NO); |
52 | #if START_ARM | 62 | #if START_ARM |
53 | GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, NULL, NULL); | 63 | GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL); |
54 | #endif | 64 | #endif |
55 | } | 65 | } |
56 | 66 | ||
@@ -83,7 +93,7 @@ static void | |||
83 | arm_notify (void *cls, int success) | 93 | arm_notify (void *cls, int success) |
84 | { | 94 | { |
85 | GNUNET_assert (success == GNUNET_YES); | 95 | GNUNET_assert (success == GNUNET_YES); |
86 | GNUNET_ARM_start_service (arm, "resolver", TIMEOUT, &resolver_notify, NULL); | 96 | GNUNET_ARM_start_service (arm, "resolver", START_TIMEOUT, &resolver_notify, NULL); |
87 | } | 97 | } |
88 | 98 | ||
89 | 99 | ||
@@ -98,7 +108,7 @@ task (void *cls, | |||
98 | sched = s; | 108 | sched = s; |
99 | arm = GNUNET_ARM_connect (cfg, sched, NULL); | 109 | arm = GNUNET_ARM_connect (cfg, sched, NULL); |
100 | #if START_ARM | 110 | #if START_ARM |
101 | GNUNET_ARM_start_service (arm, "arm", TIMEOUT, &arm_notify, NULL); | 111 | GNUNET_ARM_start_service (arm, "arm", START_TIMEOUT, &arm_notify, NULL); |
102 | #else | 112 | #else |
103 | arm_notify (NULL, GNUNET_YES); | 113 | arm_notify (NULL, GNUNET_YES); |
104 | #endif | 114 | #endif |