diff options
author | LRN <lrn1986@gmail.com> | 2013-03-13 17:49:26 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-03-13 17:49:26 +0000 |
commit | 405f776bc08486af4edb80e18149c0829732b347 (patch) | |
tree | d5fc635a51641dec6b53cb2540276f34ae8f6210 /src/arm/mockup-service.c | |
parent | 3ceae682287492ecc768aea5c4c463216a35774d (diff) | |
download | gnunet-405f776bc08486af4edb80e18149c0829732b347.tar.gz gnunet-405f776bc08486af4edb80e18149c0829732b347.zip |
All-encompassing ARM update
Diffstat (limited to 'src/arm/mockup-service.c')
-rw-r--r-- | src/arm/mockup-service.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/arm/mockup-service.c b/src/arm/mockup-service.c index d9896997b..2e021627e 100644 --- a/src/arm/mockup-service.c +++ b/src/arm/mockup-service.c | |||
@@ -29,21 +29,27 @@ | |||
29 | #include "gnunet_time_lib.h" | 29 | #include "gnunet_time_lib.h" |
30 | 30 | ||
31 | 31 | ||
32 | static int special_ret = 0; | ||
33 | |||
32 | /** | 34 | /** |
33 | * Handler for SHUTDOWN message. | 35 | * Handler for STOP message. |
34 | * | 36 | * |
35 | * @param cls closure (refers to service) | 37 | * @param cls closure (refers to service) |
36 | * @param client identification of the client | 38 | * @param client identification of the client |
37 | * @param message the actual message | 39 | * @param message the actual message |
38 | */ | 40 | */ |
39 | static void | 41 | static void |
40 | handle_shutdown (void *cls, struct GNUNET_SERVER_Client *client, | 42 | handle_stop (void *cls, struct GNUNET_SERVER_Client *client, |
41 | const struct GNUNET_MessageHeader *message) | 43 | const struct GNUNET_MessageHeader *message) |
42 | { | 44 | { |
43 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 45 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
44 | _("Initiating shutdown as requested by client.\n")); | 46 | _("Initiating shutdown as requested by client.\n")); |
45 | GNUNET_SERVER_client_persist_ (client); | 47 | GNUNET_SERVER_client_persist_ (client); |
46 | GNUNET_SCHEDULER_shutdown (); | 48 | GNUNET_SCHEDULER_shutdown (); |
49 | /* ARM won't exponentially increase restart delay if we | ||
50 | * terminate normally. This changes the return code. | ||
51 | */ | ||
52 | special_ret = 1; | ||
47 | } | 53 | } |
48 | 54 | ||
49 | 55 | ||
@@ -52,7 +58,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
52 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 58 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
53 | { | 59 | { |
54 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { | 60 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { |
55 | {&handle_shutdown, NULL, GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN, | 61 | {&handle_stop, NULL, GNUNET_MESSAGE_TYPE_ARM_STOP, |
56 | sizeof (struct GNUNET_MessageHeader)}, | 62 | sizeof (struct GNUNET_MessageHeader)}, |
57 | {NULL, NULL, 0, 0} | 63 | {NULL, NULL, 0, 0} |
58 | }; | 64 | }; |
@@ -70,5 +76,7 @@ main (int argc, char *const *argv) | |||
70 | (GNUNET_OK == | 76 | (GNUNET_OK == |
71 | GNUNET_SERVICE_run (argc, argv, "do-nothing", GNUNET_SERVICE_OPTION_NONE, | 77 | GNUNET_SERVICE_run (argc, argv, "do-nothing", GNUNET_SERVICE_OPTION_NONE, |
72 | &run, NULL)) ? 0 : 1; | 78 | &run, NULL)) ? 0 : 1; |
79 | if (0 != special_ret) | ||
80 | return special_ret; | ||
73 | return ret; | 81 | return ret; |
74 | } | 82 | } |